EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: zolotoy on July 02, 2015, 01:40:35 AM



Title: Filter TreeGrid
Post by: zolotoy on July 02, 2015, 01:40:35 AM
If data that I am showing in TreeGrid is hierarchical can I filter it on the following:
1. Show Folders only
2. Show children only.


Thanks


Title: Re: Filter TreeGrid
Post by: stworthy on July 02, 2015, 03:57:33 AM
You have to custom the 'filterMatcher' function, which is called when filtering data. This method returns the filtered data regarding your filter rules.
Code:
$('#dg').datagrid({
filterMatcher: function(data){
//...
return data;
}
});


Title: Re: Filter TreeGrid
Post by: zolotoy on July 14, 2015, 12:02:26 PM
I am implementing filterMatcher as you are showing but it's not even get called.
Code:
link: function (scope, elem, attrs, ngModel) {
            $(elem).datagrid({
                   columns: [[
                       { field: 'name', title: 'Name' },
                       { field: 'itemtype', title: 'Item Type' },
                        ............
                   ]],
                   filterMatcher: function(data){
                       return scope.filterAssetProjects(data); // [b]never gets here.[/b]
                   }                   
            });
            ngModel.$render = function (value) {
                $(elem).datagrid('loadData', ngModel.$viewValue);
            }
        }