How to filter TreeViewAdv with RecordFilters

I am new to C# and SyncFusion and would really appreciate your help.

I need to have the correct records shown in TreeViewPresenter(TreeViewAdv) after filtering gridGroupingControl .

First I thought about to get the filters with:

detailGroupingControl.TableDescriptor.RecordFilters

and to set these filters in the TreeViewPresenter but it seems that it doesn't work like that. Are there any easy methods to filter the tree with the same filtering criterias as gridGroupingControl ?


If you want to add the RecordFilters from one TreeView node to another TreeView node, you have to add the objects of the grid in a list. Using this list, the filtering can be reflected to all the TreeView nodes. Please refer the below code and sample for reference,

//Used to save the objects of all grids
List<GridGroupingControl> grids = new List<GridGroupingControl>();

//add the grid to the list
grids.Add(GridGroupingControl);

void RecordFilters_Changed(object sender, Syncfusion.Collections.ListPropertyChangedEventArgs e)
{
    Syncfusion.Grouping.RecordFilterDescriptorCollection filters = sender as RecordFilterDescriptorCollection;
    foreach (GridGroupingControl grid in grids)
    {
        foreach(RecordFilterDescriptor filter in filters)
        {
            //To avoid the repeated objects from the list
            if (grid.TableDescriptor.RecordFilters.Contains(filter))
                continue;
            grid.TableDescriptor.RecordFilters.Add(filter);
        }
    }
}
链接地址: http://www.djcxy.com/p/28412.html

上一篇: 输入[type =“file”]用css检查是否存在文件附件

下一篇: 如何用RecordFilters过滤TreeViewAdv