2013-01-15 163 views
1

我有ListVIew一个充满硬编码DataModel。然后我想创建一个包含数据模型头部DropDown菜单。BB10 - ListView过滤器或搜索功能?

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

所以,我的问题是:

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

  2. 是否有任何方式使用数据模型填充DropDown'sOption

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

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

由于之前

回答

1

我问the question在黑莓支持论坛,并得到了答案:

如果我们遵循的文件,我们知道该数据模型是这样的:

<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