Welcome!

Welcome to the Official BlackBerry Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Cascades Development

Reply
Developer
gpatton
Posts: 172
Registered: ‎12-29-2010
My Carrier: Rogers

Headers are clickable?

Hi,

 

I have a list of data that is sorted alphabetically. I have the dataModel.grouping set to ItemGrouping.ByFirstChar.

 

What this does, is that all the A's are grouped and given a header "A". All the B's are grouped with the header "B" and so on.

 

But I notice that the header itself is selectable. How can this be stopped? I don't want people clicking on the header itself? 

 

This is my code below:

 

attachedObjects: [
                GroupDataModel {
                    id: dataModel
                    sortingKeys: [
                        "name"
                    ]
                    grouping: ItemGrouping.ByFirstChar
                    sortedAscending: true
                },
                DataSource {
                    id: dataSource
                    source: "list.json"
                    onDataLoaded: {
                        dataModel.insertList(data);
                    }
                }
            ]

 

Please use plain text.
Developer
strobejb
Posts: 180
Registered: ‎10-15-2012
My Carrier: Orange

Re: Headers are clickable?

I have never noticed that headers are selectable. What do you listItemComponents look like?
Please use plain text.
Contributor
AVPTI
Posts: 45
Registered: ‎06-28-2011
My Carrier: Bell

Re: Headers are clickable?

Been wondering the same thing.

Please use plain text.
Developer
igosoft
Posts: 71
Registered: ‎09-19-2012
My Carrier: Play

Re: Headers are clickable?

selectable ??

send us your QML with ListView in it

Please use plain text.
Developer
gpatton
Posts: 172
Registered: ‎12-29-2010
My Carrier: Rogers

Re: Headers are clickable?

Here is my code. Sorry for the delay.

 

Page {
        id: countryPage
        
        Container {
            
            id: countryContainer
            Container {
                id: listViewContainer
                ListView {
                    id: countryList
                    objectName: "countryList"
                    dataModel: dataModel
                    listItemComponents: [
                        ListItemComponent {
                            type: "item"
                            StandardListItem {
                                title: ListItemData.name
                            }
                        }
                    ]
                    onTriggered: {
                        var chosenItem = dataModel.data(indexPath);
                        countryView = chosenItem;
                        page = countryPageDefinition.createObject();
                        countryNav.push(page);
                    }
                }
            }
            attachedObjects: [
                GroupDataModel {
                    id: dataModel
                    //objectName: "countryDataModel"
                    sortingKeys: [
                        "name"
                    ]
                    sortedAscending: true
                    grouping: ItemGrouping.ByFirstChar
                },
                DataSource {
                    id: dataSource
                    source: "countriesCustom.json"
                    onDataLoaded: {
                        dataModel.insertList(data);
                    }
                }
            ]
        }

 

Please use plain text.
Developer
strobejb
Posts: 180
Registered: ‎10-15-2012
My Carrier: Orange

Re: Headers are clickable?

You need to provide the ListView with a propert Header listItemComponent, in addition to the StandardListItem you already have

 

ListItemComponent {
                            type: "header"
                            Header {
                                title: ListItemData
                            }
                        }
Please use plain text.
Developer
gpatton
Posts: 172
Registered: ‎12-29-2010
My Carrier: Rogers

Re: Headers are clickable?

Tried that. Still doesn't work. The header is still clickable.

Please use plain text.
Regular Contributor
Q-T
Posts: 69
Registered: ‎12-02-2011
My Carrier: none

Re: Headers are clickable?

Must be possible because I don't have the problem in C++  I just connect my listView's triggered and activated signals to my own slots.  The header's never never respnd to  clicks.

 

 

Please use plain text.