Esempio n. 1
0
 private void runFilter(string filter)
 {
     using (var operation = new FilterNodeOperation(filter, ShowDescendantNode))
     {
         treeView.DoWithinBatchUpdate(() => treeView.NodesIterator.DoOperation(operation));
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 实现树节点的过滤查询
        /// </summary>
        private void InitSearchControl1()
        {
            this.treeList1.OptionsBehavior.Editable            = false;
            this.treeList1.OptionsView.EnableAppearanceOddRow  = true;
            this.treeList1.OptionsView.EnableAppearanceEvenRow = true;
            //this.treeList1.OptionsView.RowIma = RowImagesShowMode.InCell;//紧凑型图标
            //this.treeList1.RowHeight = 20;
            this.treeList1.ExpandAll();

            this.treeList1.OptionsView.ShowAutoFilterRow   = true;     //显示过滤行
            this.treeList1.OptionsBehavior.EnableFiltering = true;     //开启过滤功能
            this.treeList1.ColumnFilterChanged            += (s, e) => //自定义过滤事件
            {
                var tree = (TreeList)s;
                if (tree != null && tree.ActiveEditor != null)
                {
                    string newKey = tree.ActiveEditor.EditValue.ToString();
                    tree.FilterNodes();

                    var operation = new FilterNodeOperation(newKey ?? "");
                    tree.NodesIterator.DoOperation(operation);
                }
            };

            ////初始化树节点选择事件
            //this.treeList1.FocusedNodeChanged += (s, e) =>
            //{
            //    this.FocusedNodeChanged(s, e);
            //};
        }
        private void applyFilterButton_Click(object sender, EventArgs e)
        {
            FilterNodeOperation operation = new FilterNodeOperation(textEdit1.EditValue != null ? textEdit1.EditValue.ToString() : "");

            treeList1.NodesIterator.DoOperation(operation);
        }