ListView no header

Hey, I'm looking for a way to use a ListView which is the only level of depth (that is to say, has no header). I try the example of stamp collector to work this way, but I'm having a lot of problems by pulling it.

Using this code, I get all the stamps under an empty header:

mStampModel = new GroupDataModel();
mStampModel-> setParent (this);
mStampModel-> clear();
mStampModel-> insert (mainList);

but the empty header always appears.

I guess GroupDataModel is the incorrect data model for this but QListDataModel also seems to want to create a header and I see that DataSetModel is marked as being obsolete (don't know if it would achieve what I want anyway).

Thoughts, ideas, solutions?

You can find QStringListDataModel or QVariantListDataModel is sufficient for your needs.

In stampcollector:

-change main.qml to remove the header component.

-Replace stampcollector.h #include and mStampModel of type QStringListDataModel *.   (in an application real you can use your own typedef so you do not have to include in the include file)

-change of setUpStampListModel to

mStampModel = new QStringListDataModel;
mStampModel-> setParent (this);
mStampModel-> clear();

mStampModel-> append("hello");
mStampModel-> append("World");

Of course app will only run as far as the first list, but try and see if it is what you need

Tags: BlackBerry Developers

Similar Questions

  • List different with JSON types

    I created a flat list using the group view: no technique mentioned here:

    http://supportforums.BlackBerry.com/T5/Cascades-development/ListView-no-header/TD-p/1737097/HIGHLIGH...

    I'm changing my list to display differently depending on the type, as indicated in the JSON.  My first category in my JSON is kind, but I can't seem to get that list appears correctly.

    for example.

    {'type': 'image', 'url': "http://whatever"}

    I was able to do it in XML, but cannot do it in JSON.  Someone at - it suggestions?

    Another method in QML is to do the following

    var chosenItem = dataModel.data(indexPath);
    return chosenItem.type
    
  • Group/expandable list view display

    Hello

    I have to create the list view, which brought together the person using his first letter.

    Now, I want to know that is it possible to display the particular item in the listview with header.

    I mean at the same time that a group should be open. and first, the Group should be invisible.

    Any user group will tap the contact in this group must be visible.

    So I tried with the current listview with header.

    But I'm not able to do the job I want.

    So is that what someone did this thing with the default listview.

    Is this possible?

    If Yes, how can I achieve this?

    I want exactly like expandablelistview in the android.

    Thanks in advance.

    bskania.

    Try to look at this example: https://github.com/blackberry/Cascades-Samples/tree/master/FilteredListView. I think that you will find what you are looking for.

    It may be useful

  • How can I fixed listView header in GroupDataModel.

    Hello

    I want to set my header of the listview as a guess I put the listView header in GroupDataModel (Group: ItemGrouping.ByFirstChar). and now when scroll us in listview header must be fixed on what is the current title of the item in the listview. like Blackberry Hub.

    Thank you

    You can use the sample to reach this.

    dataModel: GroupDataModel {
                    grouping: ItemGrouping.ByFirstChar
                    sortingKeys: [ "title" ]
                }
                layout: StackListLayout {
                    headerMode: ListHeaderMode.Sticky
                }
    
  • Alignment and Listview header history

    I want to display header of the listview to centerd horizontally and give it a background color? I tried but its not working

    Hello

    Please given the size container means a full width based on the width of the screen. I hope that they conver the part with the gray color.

    Thank you

    Umang.

  • ListView, title change to header based on the stored value.

    Hello

    I'm new to native development, always trying to get a hang of how things are done in QML. I was wondering how it was possible to format the header in the ListView based on the value of the header. For example, the datamodel is sorted by name and status. Status is stored as an integer 0,1,2,3,4,5 in the database. Whenever the ListView displays the headers, I want to show the actual title of the State (for example in progress, completed) instead of display 0 or 1.

    Thank you for your help.

    If... else if... else must have worked well, please send your code.

  • ListView & heads

    Hello!

    I'm having some difficulty with the definition of the properties of the my ListView header.

    Here are some of my code QML:

    ListView {
                id: threadView
                objectName: "threadView"
    
                dataModel: GroupDataModel {
                    id: modelPost
                    sortingKeys: ["timestamp"]
                    grouping: ItemGrouping.ByFullValue
                }
    
                listItemComponents: [
    
                    ListItemComponent {
                        type: "header"
                        Header {
                            id: header
                            title: ListItemData.author
                            subtitle: ListItemData.timestamp
                        }
                    },
    
                    ListItemComponent {
                        type: "item"
    
                        PostRenderer {
                        }   
    
                    }
                ]
            }
    

    As you can see, what I want to do is to sort items by time stamp. But the legend must be something else: the author of the message.

    And with the current code, the question I have, is that the header shows nothing... so just the gray rectangle + the blue line. No text.

    Strangely (to me), I don't see a content in the header if I write something like this:

    Header {
          id: header
          title: ListItemData
          subtitle: ListItemData.timestamp
    }
    

    And then he does not care about the subtitle, view just the title, and the title will be the sort key: the time stamp.

    I'm not sure that, in the doc:

    - http://developer.blackberry.com/native/reference/cascades/bb__cascades__header.html

    - http://developer.blackberry.com/native/reference/cascades/bb__cascades__listitemcomponent.html

    It seems that we could do it like this. Could someone tell me what I'm missing?

    BTW, I also see in the doc that the listItemComponent sometimes have a type "listItem", but in my experience, if it's not only "item" I won't be able to choose what will be displayed in the points...

    Could you tell me why?

    Thank you!

    Hello!

    GroupDataModel groups elements, in this case of timestamp. In the header of the function data() (ListItemData in QML) returns a common timestamp for this group of items. So he has no fields such as .title etc, it is just a timestamp. The fields are available only for items.

    As there can be multiple elements in the model with a given timestamp, additional logic will be necessary to search for a specific item, for example, while reiterating the and find a first point with this timestamp.

    Regarding "itemType" and "element":

    GroupDataModel returns the type "header" for the headers and 'article' for items. This can be replaced by the implementation of the function GroupDataModel::itemType() or declaring a function JavaScript itemType() QML and returning a string different for some (or all) indexPaths. ListView uses a ListItemComponent with corresponding itemType.

  • Change the grouping ListView header text

    So I am grouping my pursuant to this section:

    http://developer.BlackBerry.com/native/documentation/Cascades/UI/lists/groupdatamodel.html

    Everything works fine, but now I need customize the header shown in the QML text by adding something to it.  What can I change in the header to adjust the title?

    {ListItemComponent}
    type: "header.

    {To header
    Title: sortedTitle? + "- add"
    }
    },

    My ultimate goal is to add a logic based on the header title text that would normally appear.  Is this possible?

    I should have better.  Just using ListItemData instead of ListItemData.xx in the header element, it is what works.

  • How to add a control to a type of header item in a ListView

    How can I add a toggle button on the right side of the header? is there a way to do this?  Thank you.

    You would need to do a custom component for your header instead of using the standard one. Refer to the section "Customization of the appearance of list items" here, to start: https://developer.blackberry.com/native/documentation/cascades/ui/lists/list_view.html

  • onTriggered retail Info (LISTVIEW)

    Hello

    Sorry to ask again

    I want to show the details of my promo

    It's my main QML

    NavigationPane {
               id : nav1
               onPopTransitionEnded: page.destroy()
            Page {
    
                Container {
                    Header{
                        title: "Promo"
                    } 
    
                    ListView {
                        id: listViewDemo
                        dataModel: GroupDataModel {
                            id : prm1
                            grouping: ItemGrouping.None
                        }
                        listItemComponents: [
                            ListItemComponent {
                                type: "promo"
                                Container {
                                    layout: StackLayout {
                                        orientation: LayoutOrientation.LeftToRight
                                    }
                                    WebView {
                                        preferredWidth: 150
                                        preferredHeight: 90
                                        verticalAlignment: VerticalAlignment.Top
                                        url : ListItemData["ImageLink"]
    
                                    }
                                    StandardListItem {
                                        title: ListItemData["promoID"] + "." + ListItemData["Title"]
                                        description: ListItemData["Description"]
                                        leftMargin: 30
                                        verticalAlignment: VerticalAlignment.Center  
    
                                        }
    
                                 }
                              }
                        ]  
    
                        function itemType(data, indexPath) {
                            return "promo";
                    }
    
                    onTriggered: {
                        if(indexPath!=0){
                            var promo = prm1.data(indexPath);
                            var promodetail = promocontent.createObject();
                            promodetail.promo = promo;
                            nav1.push(promocontent);
                        }
                    }
                    }
                    }
                 }
             }
    
                attachedObjects: [
                    DataSource {
                        id: serviceDataSource
                        source:                                  "http://www.rws.rajaspot.com/rs_promoclient.php"
                        type: DataSourceType.Json
                        onDataLoaded: {
                        listViewDemo.dataModel.insertList(data.promo_info)
                        }
                    },
                    ComponentDefinition {
                        id : promocontent
                        source : "PromoContent.qml"
                    }
                ]
    
                onCreationCompleted: {
                    serviceDataSource.load();
                }
    

    It's my promodetail

    Page {
        property variant promo;
        Container {
    
            id: container1
            verticalAlignment: VerticalAlignment.Center
            horizontalAlignment: HorizontalAlignment.Center
            topPadding: 50
            WebView {
    
                id : imageview
                horizontalAlignment: HorizontalAlignment.Center
                url: promo["ImageLink"]
                preferredWidth: 400
                preferredHeight: 400
            }
            Label {
    
                id:label1
                textStyle.base: SystemDefaults.TextStyles.BigText
                horizontalAlignment: HorizontalAlignment.Center
                text:promo["Title"]
            }
            Label {
                id:label2
                textStyle.base: SystemDefaults.TextStyles.SubtitleText
                horizontalAlignment: HorizontalAlignment.Center
                text:promo["Description"]
            }
        }
    }
    

    the following error message are

    url: promo["ImageLink"]
    
    text:promo["Title"]
    
    text:promo["Description"]
    

    He can't call my main.qml

    any suggestion?

    Thank you

    In some cases, your promo property can be "undefined" after you press page. Because it is not yet assigned. You can avoid this if you check the property on your page.
    For example:

    Page{
        property variant promo: null
    
        Container{
            layout: DockLayout{}
            leftPadding: 20
            rightPadding: 20
            topPadding: 20
    
            Label{
                id: label
                horizontalAligment: HorizontalAligment.Center
                /* In some cases will be the text empty. Because promo property is not yet assigned*/
                text: promo.Description
            }
        }
    }
    

    -------------------------------------------------
    See the simple example. You have two options to avoid ownership promo "undefined".
    1. replace the text property of the label with this
    text: promo? Promo. Description:
    2. signal property promo label definition
    onPromoChanged: if (promo) label.text = promo. Description

    My English is bad, so I hope you understand what I mean. Maybe someone who has good English can specify my 'answer '.

    EDIT:

    You can also find 'Data passing between the QML pages' for more information

  • ListView and ListItem displaying funny

    How is it when I have my. XML directly in my ListView, all list items display correctly, but if I add data to a data source, it is not.

    Example below because I can't explain it very well.

    ListView {
                dataModel: XmlDataModel {
                    source: "hills.xml"
                }
                listItemComponents: [
                    ListItemComponent {
                        type: "listItem"
                        StandardListItem {
                            title: ListItemData.skiHill
                        }
                    },
                    ListItemComponent {
                        type: "header"
                        Header {
                            title: ListItemData.key
                            touchPropagationMode: TouchPropagationMode.None
                        }
                    }
    

    Vs.

    ListView {
                dataModel: dataModel
                listItemComponents: [
                    ListItemComponent {
                        type: "listItem"
                        StandardListItem {
                            title: ListItemData.skiHill
                        }
                    },
                    ListItemComponent {
                        type: "header"
                        Header {
                            title: ListItemData.key
                            touchPropagationMode: TouchPropagationMode.None
                        }
                    }
    
    ...
    
    attachedObjects: [
            GroupDataModel {
                id: dataModel
                sortingKeys: [
                    "skiHill"
                ]
            },
            DataSource {
                id: dataSource
                source: "hills.xml"
                query: "/root/listItem"
                onDataLoaded: {
                    dataModel.insertList(data);
                }
            }
    

    On the 2nd day of two different types of lists, the list item displays the news from another part of my XML, not the name of ski hill.

    Your head should look like:

     ListItemComponent {
                        type: "header"
                        Header {
                            title: ListItemData
                            touchPropagationMode: TouchPropagationMode.None
                        }
                    }
    

    i.e. just use ListItemData for the title - because since a GroupDataModel (and probably XmlDataModel) the first level of the row is always returned as a string, not as a piece of real data that has properties

    ListItemComponent {
                        type: "item"
                        StandardListItem {
                            title: ListItemData.skiHill
                        }
                    },
    

    Your list items must have the type 'point' - because that's what indicates the GroupDataModel.

    You can substitute by using a reminder in QML itemType(), if you need something different, or if you need a mixture of different types in the list

  • Application of C++ ListView

    Hello

    I am developing an application that uses a ListView in C++, but the last element of the list printed by the console is displayed at the top of the listview in the application.

    I tried affecting Crescent sorted to true and false but does not seem to make any difference, so I tried to add a sort field (in this case, it's a track number and it sorts correctly but if there are more than 9 titles, then it sorts all the following list under the heading of '1'.)

    Therefore, I'm looking to sort listview with the first element of the list printed in the console to be at the top of the listview in the application and also to sort by track number and if the number is greater than 9, it can be sorted in a header from 10, 11 etc.

        m_NewDataModelTrack = new GroupDataModel(QStringList() << "trackNumber");
        m_NewDataModelTrack->setSortedAscending(true);
        m_NewDataModelTrack->setGrouping(ItemGrouping::None);
    
        QVariantMap newMap2;
    
        QVariantList secondary = jsonData.toMap().value("items").toList();
        for (QList::iterator it2 = secondary.begin(); it2 != secondary.end(); it2++) {
    
            QVariantMap mapReturnInfo2 = it2->toMap();
    newMap2["trackNumber"] = mapReturnInfo2.value("track_number").toString();
    
     m_NewDataModelTrack->insert(newMap2);
    
        }
    
    m_listViewTrack = Application::instance()->findChild("listViewTrack");
    
    m_listViewTrack->setDataModel(m_NewDataModelTrack);
    

    Any help would be greatly appreciated

    Finished by sorting according to one of the field and then used setSortedAscending (true) so now it works like a list from A to Z; not quite what I was looking but the watch, it would be easier for the user to navigate and find objects

    m_NewDataModel = new GroupDataModel(QStringList() << "track");
    m_NewDataModel->setSortedAscending(true);
    m_NewDataModel->setGrouping(ItemGrouping::None);
    
  • indicator problem ListView and activity

    Hi, I was playing around with the sample application address book so that I have included a button to re-populate the list view. It takes a few seconds, that's why I've included an indicator of activity runs while the list view is being filled.

    The activity indicator is supposed to start when the button is pressed and stop when the display of the list has been entered.

    Now, my problem is that the activity indicator seems to start when the display of the list has been populated (it just starts and stops in a Flash). I have also included a header which changes the onbuttonclicked text to check if that was the problem-indicator of activity but same thing happening (text only changes after listview is filled). The list view appears to stop all operations until it was settled.

    What is the cause and how can I solve this problem? Thank you.

    onButtonClicked {}
    change the header text
    start the activity indicator
    fill listview
    }

    Then in c ++ after m_model-> insert (map) I emit a stop to the activity indicator signal.

    Indicator text and header activity does not change until the listview has been briefed.

    as the list of all the opinions of the population occurs on the event thread indicator gets no time to do things.
    If you would like to fill in the asynchronous list, it should work as expected.

    as a sidenote: have a look to refresh the headers, they are often used to reload a list.

  • On the ListView component

    Hi all

    I have already created a simple list of 2 level (header, item) to an XML file.
    The default ListView displays the headers and elements. I want to know if it is possible to do sizable, I mean I want my list just presenting the elements of headers when the user clicks on an element of the header, the second level is displayed (and if they click the header again, he second level cache).
    Do you think I can handle this kind of list with Qml?

    Thanks for your help,
    Laurent

    The attached example illustrates the use of a custom data model to populate a list.

    The style is bad, then it comes in the form of light text on a pale background.

    If you click on 'Hello' then 'Hello' expands.  Click again and it collapses.

    Ditto for "the world".

    Is - this pretty much what you're looking for?

    Stuart

  • ListView with GridListLayout will not display items

    I can easily create a ListView that displays its items.

    The following XML code:

    
        

    And here's the QML:

                ListView {
                    dataModel: XmlDataModel {
                        source: "asset:///test.xml"
                    }
    
                    listItemComponents: [
                        ListItemComponent {
                            type: "header"
                            Header {
                                title: ListItemData.title
                            }
                        },
                        ListItemComponent {
                            type: "item"
                            Label {
                                text: ListItemData.name
                            }
                        }
                    ]
                }
    

    The result looks like this:

    But what I really want are the items to display in a grid. To do this, I put the ListView layout property to a GridListLayout:

                    layout: GridListLayout {
                    }
    

    When I do that, it shows more elements, only the headers:

    What I am doing wrong?

    In the end I tried to get this working using a custom LitemItemProvider that uses images for the elements, but even once, it would display only the headers.  So I simplified my example as much as I can above to try to identify the problem.  I don't know how to do the simple example.  I am able to get my original code works fine even with the GridListLayout if I do not activate the grouping - as soon as I activate the grouping (so that the data has headers and elements), it starts to behave like that.

    The display of the grid is not compatible with the Group?  The application of native images only grouping with a grid view, and I am trying to imitate that.  Super confused.

    You must set headerMode

    https://developer.BlackBerry.com/native/reference/Cascades/bb__cascades__gridlistlayout.html#propert...

Maybe you are looking for

  • Satellite: A30 - 404: gives TV-out black / white

    I have a SA30-404. I installed PAL. I checked the cables with one laptop from another manufacturer (!) and the TV still gives black / white. I have installed Intels Extreme Graphics 2. This doesnot even improve things. So, what I can do. Which driver

  • A few questions to Satellite P200-141

    Hi all I bought my Toshiba +/-2/3 months, now I have the following problems:-Dvd Player does not open correctly, I push the button, and then he clicks on, then I have to push a little bit more on the dvd player and then it opens-My headphone plug is

  • 4071 PXI get negative resistance readings

    Hi all We are working on a system where we measure current leakage and resistance using a PXI-4071 with some other gear as well as a map to relay SMU and 2530 b.. The main problem is that for some measures of resistance we are seeing negative values

  • Update security KB2286198 deleted icons and set State Office back to initial

    After the automatic installation of critical update 2286198 KB, my office was missing Explorer icons and looked weird. To restart, he went to a "Welcome" screen and the different wallpaper, etc. I had to do a system restore to yesterday to return to

  • Best laptop game out there?

    Hi, is anyone aware of the best gaming laptop I can find right now? The price is not really a problem at this point, I just want to see what's out there. Thank you!