Skip to content

Commit e676246

Browse files
authored
fix: initiallyCollapsed should work with hierarchical tree dataset (#2083)
* fix: `initiallyCollapsed` should work with hierarchical tree dataset
1 parent 3498d89 commit e676246

14 files changed

Lines changed: 96 additions & 3 deletions

File tree

demos/aurelia/src/examples/slickgrid/example28.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ export class Example28 {
145145
columnId: 'file',
146146
childrenPropName: 'files',
147147
excludeChildrenWhenFilteringTree: this.isExcludingChildWhenFiltering, // defaults to false
148+
// initiallyCollapsed: true,
148149

149150
// skip any other filter criteria(s) if the column holding the Tree (file) passes its own filter criteria
150151
// (e.g. filtering with "Files = music AND Size > 7", the row "Music" and children will only show up when this flag is enabled

demos/react/src/examples/slickgrid/Example28.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ const Example28: React.FC = () => {
146146
columnId: 'file',
147147
childrenPropName: 'files',
148148
excludeChildrenWhenFilteringTree: isExcludingChildWhenFilteringRef.current, // defaults to false
149+
// initiallyCollapsed: true,
149150

150151
// skip any other filter criteria(s) if the column holding the Tree (file) passes its own filter criteria
151152
// (e.g. filtering with "Files = music AND Size > 7", the row "Music" and children will only show up when this flag is enabled

demos/vanilla/src/examples/example06.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export default class Example06 {
4646
undefined,
4747
this.datasetHierarchical
4848
);
49+
// this.sgb.datasetHierarchical = this.datasetHierarchical;
4950
document.body.classList.add('salesforce-theme');
5051
}
5152

@@ -166,6 +167,7 @@ export default class Example06 {
166167
columnId: 'file',
167168
childrenPropName: 'files',
168169
excludeChildrenWhenFilteringTree: this.isExcludingChildWhenFiltering, // defaults to false
170+
// initiallyCollapsed: true,
169171

170172
// skip any other filter criteria(s) if the column holding the Tree (file) passes its own filter criteria
171173
// (e.g. filtering with "Files = music AND Size > 7", the row "Music" and children will only show up when this flag is enabled

demos/vue/src/components/Example28.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ function defineGrid() {
171171
columnId: 'file',
172172
childrenPropName: 'files',
173173
excludeChildrenWhenFilteringTree: isExcludingChildWhenFiltering.value, // defaults to false
174+
// initiallyCollapsed: true,
174175
175176
// skip any other filter criteria(s) if the column holding the Tree (file) passes its own filter criteria
176177
// (e.g. filtering with "Files = music AND Size > 7", the row "Music" and children will only show up when this flag is enabled

frameworks/angular-slickgrid/src/demos/examples/example28.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ export class Example28Component implements OnInit {
150150
columnId: 'file',
151151
childrenPropName: 'files',
152152
excludeChildrenWhenFilteringTree: this.isExcludingChildWhenFiltering, // defaults to false
153+
// initiallyCollapsed: true,
153154

154155
// skip any other filter criteria(s) if the column holding the Tree (file) passes its own filter criteria
155156
// (e.g. filtering with "Files = music AND Size > 7", the row "Music" and children will only show up when this flag is enabled

frameworks/angular-slickgrid/src/library/components/__tests__/angular-slickgrid.component.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ const treeDataServiceStub = {
206206
convertFlatParentChildToTreeDatasetAndSort: vi.fn(),
207207
dispose: vi.fn(),
208208
handleOnCellClick: vi.fn(),
209+
initHierarchicalTree: vi.fn(),
209210
sortHierarchicalDataset: vi.fn(),
210211
toggleTreeDataCollapse: vi.fn(),
211212
} as unknown as TreeDataService;

frameworks/angular-slickgrid/src/library/components/angular-slickgrid.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ export class AngularSlickgridComponent<TData = any> implements AfterViewInit, On
237237
// when a hierarchical dataset is set afterward, we can reset the flat dataset and call a tree data sort that will overwrite the flat dataset
238238
if (newHierarchicalDataset && this.slickGrid && this.sortService?.processTreeDataInitialSort) {
239239
this.sortService.processTreeDataInitialSort();
240+
this.treeDataService.initHierarchicalTree();
240241

241242
// we also need to reset/refresh the Tree Data filters because if we inserted new item(s) then it might not show up without doing this refresh
242243
// however we need to queue our process until the flat dataset is ready, so we can queue a microtask to execute the DataView refresh only after everything is ready

frameworks/aurelia-slickgrid/src/custom-elements/aurelia-slickgrid.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,7 @@ export class AureliaSlickgridCustomElement {
678678
// when a hierarchical dataset is set afterward, we can reset the flat dataset and call a tree data sort that will overwrite the flat dataset
679679
if (newHierarchicalDataset && this.grid && this.sortService?.processTreeDataInitialSort) {
680680
this.sortService.processTreeDataInitialSort();
681+
this.treeDataService.initHierarchicalTree();
681682

682683
// we also need to reset/refresh the Tree Data filters because if we inserted new item(s) then it might not show up without doing this refresh
683684
// however we need to queue our process until the flat dataset is ready, so we can queue a microtask to execute the DataView refresh only after everything is ready

frameworks/slickgrid-react/src/components/slickgrid-react.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
231231
if (this.dataView && newHierarchicalDataset && this.grid && this.sortService?.processTreeDataInitialSort) {
232232
this.dataView.setItems([], this._options?.datasetIdPropertyName ?? 'id');
233233
this.sortService.processTreeDataInitialSort();
234+
this.treeDataService.initHierarchicalTree();
234235

235236
// we also need to reset/refresh the Tree Data filters because if we inserted new item(s) then it might not show up without doing this refresh
236237
// however we need to queue our process until the flat dataset is ready, so we can queue a microtask to execute the DataView refresh only after everything is ready

frameworks/slickgrid-vue/src/components/SlickgridVue.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ watch(
257257
if (dataview && newHierarchicalDataset && grid && sortService?.processTreeDataInitialSort) {
258258
dataview.setItems([], _gridOptions.value?.datasetIdPropertyName ?? 'id');
259259
sortService.processTreeDataInitialSort();
260+
treeDataService.initHierarchicalTree();
260261
261262
// we also need to reset/refresh the Tree Data filters because if we inserted new item(s) then it might not show up without doing this refresh
262263
// however we need to queue our process until the flat dataset is ready, so we can queue a microtask to execute the DataView refresh only after everything is ready

0 commit comments

Comments
 (0)