1

我有ListVIew那个充满了硬编码的DataModel. 然后我想创建DropDown包含 dataModel 标头的菜单。

当我选择该DropDown选项时,我只想ListView显示所选标题的项目。

所以,我的问题是:

  1. 我怎样才能做到这一点QML

  2. 有没有办法DropDown's Option用数据模型填充?

以下是我的应用程序的结构:

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

之前谢谢

4

1 回答 1

1

我在黑莓支持论坛上问了这个问题并得到了答案:

如果我们按照文档,我们知道 dataModel 看起来像这样:

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

然后我们将 更改rootIndexPath为标题的索引。所以只显示该标题的孩子。索引是数组整数类型

myListView.rootIndexPath = [0] //Show all child of first header
myListView.rootIndexPath = [1] //Show all child of second header
于 2013-01-15T12:01:37.717 回答