Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1533,6 +1533,17 @@ describe('Angular-Slickgrid Custom Component instantiated via Constructor', () =
});

describe('Tree Data View', () => {
it('should throw an error when enableTreeData is enabled with Pagination since that is not supported', (done) => {
try {
component.gridOptions = { enableTreeData: true, enablePagination: true } as GridOption;
component.ngAfterViewInit();
} catch (e) {
expect(e.toString()).toContain('[Angular-Slickgrid] It looks like you are trying to use Tree Data with Pagination but unfortunately that is simply not supported because of its complexity.');
component.destroy();
done();
}
});

it('should throw an error when enableTreeData is enabled without passing a "columnId"', (done) => {
try {
component.gridOptions = { enableTreeData: true, treeDataOptions: {} } as GridOption;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,11 @@ export class AngularSlickgridComponent implements AfterViewInit, OnDestroy, OnIn
}
});

// Tree Data with Pagiantion is not supported, throw an error when user tries to do that
if (this.gridOptions && this.gridOptions.enableTreeData && this.gridOptions.enablePagination) {
throw new Error('[Angular-Slickgrid] It looks like you are trying to use Tree Data with Pagination but unfortunately that is simply not supported because of its complexity.');
}

// when dealing with Tree Data View, make sure we have necessary tree data options
if (this.gridOptions && this.gridOptions.enableTreeData && (!this.gridOptions.treeDataOptions || !this.gridOptions.treeDataOptions.columnId)) {
throw new Error('[Angular-Slickgrid] When enabling tree data, you must also provide the "treeDataOption" property in your Grid Options with "childrenPropName" or "parentPropName" (depending if your array is hierarchical or flat) for the Tree Data to work properly');
Expand Down