02-07-2013 01:18 AM
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);
}
}
]
02-07-2013 01:46 AM
02-08-2013 01:21 PM
Been wondering the same thing.
02-08-2013 05:46 PM
selectable ??
send us your QML with ListView in it
02-09-2013 06:32 PM
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);
}
}
]
}
02-10-2013 05:31 AM
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
}
}
02-11-2013 07:44 PM
Tried that. Still doesn't work. The header is still clickable.
02-11-2013 10:01 PM
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.