开发者

Flex, filter tree using ITreeDataDescriptor without reload and close all nodes

开发者 https://www.devze.com 2023-02-05 09:00 出处:网络
working with flex 4 and implemen开发者_开发知识库ting filtering using ITreeDataDescriptor. Filtering worked as expected like the following code snippet

working with flex 4 and implemen开发者_开发知识库ting filtering using ITreeDataDescriptor. Filtering worked as expected like the following code snippet

however, i am trying to create a on-demand type of filter where user would type in the search clause in a TextInput, and as the user types, the tree nodes would be filtered on the fly.

my implementation now is have user click on the search button and then reapply the dataDescriptor then reload the data. A big problem is that the whole tree collapses after setting the dataProvider again.

any suggestion on how the on-demand filter can be achieved?

var dataFilter:ServicePricingFilter = new MyFilter();
dataFilter.searchString = this.txtSearchKeyword.text;
this.treeService.dataDescriptor = new MyDataDescriptor(dataFilter);
this.treeService.dataProvider = getTreeData();


I think you shouldn't set the dataprovider every time but use insted the filterFunction property available for ListCollectionView classes (ArrayCollection, XMLListCollection,...)


looked at the post Florian mentioned. on-demand filtering is done by using ITreeDataDescriptor and a filterFunction. on keyup event of the search TextInput, call invalidateList() function on the tree.

see the source code provided for the following post http://www.davidarno.org/2009/04/01/how-to-filter-all-nodes-of-a-flex-tree-component/

0

精彩评论

暂无评论...
验证码 换一张
取 消