Filtering a TcxTreeList

Is it possible to have an optional filter in a TcxTreeList and only show the leaves that meet the filter criteria for the column (selectable by the user, like with a grid).

I thought it was possible but I can't seem to find how...

ExpressQuantumTreeList 5.49 on Delphi XE


There is no built-in filtering feature for the TcxTreeList. I would reiterate the tree on each filter data change and set the node's Visible property to false. After that call the DataChanged method of TcxTreeList to refresh the display.

I usually work with DevExpress components in Provider Mode. I have an internal TList descendant that holds my items. In this case I could have 2 lists: TListAllItems and TListFilteredItems.

My TcxTreeList would display the items from TListFilteredItems. When the TreeList is first populated both lists would hold the same items. Whenever I filter my list I would delete/add the items from TListFilteredItems and call CustomDataController.DataChanged . Then the filtered-out items would not be displayed, for TListFilteredItems does not contain them.

This would not take much memory, for only the first list TListAllItems would own the items, while the other would only hold the pointers, and not Free the items upon deletion, or Create them when adding, but just add/delete the item's pointer to the internal TList object.

链接地址: http://www.djcxy.com/p/31048.html

上一篇: aspxgridview头过滤器可以从列内容中多选择

下一篇: 过滤一个TcxTreeList