Pregunta

I have ListVIew that is filled with hard-coded DataModel. Then I want to create DropDown menu that contains the dataModel header.

When I select the DropDown option, I want ListView to only show the items for the selected header.

So, my questions are:

  1. How can I do this in QML?

  2. Is there any way to populate the DropDown's Option with the data model?

Below is my application's structure:

 Page{
     Container{
         DropDown{} //onSelectedValueChanged, I want the ListView filtered
         ListView{
              dataModel: XmlDataModel{...}
              listItemComponents: [...]
         }
     }
 }

Thanks before

¿Fue útil?

Solución

I asked the question in Blackberry support forum and got the answer:

If we follow the documentation, we know that dataModel looks like this:

<root>
    <header> ... </header>
    <header> ... </header>
    <header> ... </header>
</root>

Then we change the rootIndexPath to the index of the header. So only the child of that header is shown. The index is in array integer type

myListView.rootIndexPath = [0] //Show all child of first header
myListView.rootIndexPath = [1] //Show all child of second header
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top