加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 如何使用RecordFilters过滤TreeViewAdv

发布时间:2020-12-15 07:45:59 所属栏目:百科 来源:网络整理
导读:我是C#和SyncFusion的新手,非常感谢你的帮助. 在过滤gridGroupingControl之后,我需要在TreeViewPresenter(TreeViewAdv)中显示正确的记录. 首先,我想到了以下过滤器: detailGroupingControl.TableDescriptor.RecordFilters 并在TreeViewPresenter中设置这些
我是C#和SyncFusion的新手,非常感谢你的帮助.

在过滤gridGroupingControl之后,我需要在TreeViewPresenter(TreeViewAdv)中显示正确的记录.

首先,我想到了以下过滤器:

detailGroupingControl.TableDescriptor.RecordFilters

并在TreeViewPresenter中设置这些过滤器,但似乎它不起作用.是否有任何简单的方法可以使用与gridGroupingControl相同的过滤标准来过滤树?

解决方法

如果要将RecordFilters从一个TreeView节点添加到另一个TreeView节点,则必须在列表中添加网格对象.使用此列表,过滤可以反映到所有TreeView节点.请参考以下代码和样本以供参考,
//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);
        }
    }
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读