01-15-2013 12:25 AM - edited 01-15-2013 12:35 AM
Hi, I have ListVIew that is filled with hard-coded DataModel. Then I want to create DropDown menu that contains the header's title.
When I select the DropDown option, I want ListView will only show the items for the selected header.
So, my questions is:
1. How can I do this in QML?
2. Is there any way to populate the DropDown's Option with the data model?
Here's my application structure:
Page{
Container{
DropDown{} //onSelectedValueChanged, I want the ListView filtered
ListView{
dataModel: XmlDataModel{...}
listItemComponents: [...]
}
}
}
Thanks before
01-15-2013 03:57 AM
01-15-2013 06:18 AM - edited 01-15-2013 07:11 AM
Hi, thanks for the answer. I managed to create the filter. But after selecting the DropDown option, it disables the layout I set.
My ListView is 2 columns, so after changing the rooIndexPath, it becomes 1 column.
I tried to re-apply the properties but it does not work:
onSelectedValueChanged: {
myList.rootIndexPath = selectedValue
myList.layout.cellAspectRatio = 0.75
myList.layout.columnCount = 2
}
Any solution? Thanks
Oh and for your second answer, can you tell me how to create Option object in JavaScript? I can see that the right function to use is insert(int index, Option option) . But how to create Option object? Sorry n00b here
01-17-2013 04:43 AM
01-29-2013 07:25 PM