Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit 4f826e2

Browse files
committed
fix(filter): refreshTreeDataFilters only when Tree is enabled fixes #806
- also make sure DataView object exist before trying to get items array
1 parent 481cfc6 commit 4f826e2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/app/modules/angular-slickgrid/services/filter.service.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,9 @@ export class FilterService {
686686
});
687687

688688
// when we have a Filter Presets on a Tree Data View grid, we need to call the pre-filtering of tree data
689-
this.refreshTreeDataFilters();
689+
if (this._gridOptions?.enableTreeData) {
690+
this.refreshTreeDataFilters();
691+
}
690692
}
691693
return this._columnDefinitions;
692694
}
@@ -697,7 +699,7 @@ export class FilterService {
697699
* @param {Array<Object>} [items] - optional flat array of parent/child items to use while redoing the full sort & refresh
698700
*/
699701
refreshTreeDataFilters(items?: any[]) {
700-
const inputItems = items ?? this._dataView.getItems() ?? [];
702+
const inputItems = items ?? this._dataView?.getItems?.() ?? [];
701703

702704
if (this._dataView && this._gridOptions?.enableTreeData && inputItems.length > 0) {
703705
this._tmpPreFilteredData = this.preFilterTreeData(inputItems, this._columnFilters);
@@ -874,7 +876,9 @@ export class FilterService {
874876
});
875877

876878
// when using Tree Data, we also need to refresh the filters because of the tree structure with recursion
877-
this.refreshTreeDataFilters();
879+
if (this._gridOptions?.enableTreeData) {
880+
this.refreshTreeDataFilters();
881+
}
878882

879883
this._dataView.refresh();
880884
}

0 commit comments

Comments
 (0)