Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.
Merged
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 @@ -624,20 +624,15 @@ export class AngularSlickgridComponent implements AfterViewInit, OnDestroy, OnIn
this.gridEventService.bindOnClick(grid, dataView);

if (dataView && grid) {
this._eventHandler.subscribe(dataView.onRowCountChanged, (e: Event, args: any) => {
grid.invalidate();

this.metrics = {
startTime: new Date(),
endTime: new Date(),
itemCount: args && args.current || 0,
totalItemCount: Array.isArray(this.dataset) ? this.dataset.length : 0
};
// When data changes in the DataView, we need to refresh the metrics and/or display a warning if the dataset is empty
// we will do that via the following 2 handlers (onSetItemsCalled, onRowCountChanged)
this._eventHandler.subscribe(dataView.onSetItemsCalled, () => {
this.handleOnItemsChanged(this.dataset.length);
});

// when using local (in-memory) dataset, we'll display a warning message when filtered data is empty
if (this._isLocalGrid && this.gridOptions && this.gridOptions.enableEmptyDataWarningMessage) {
this.displayEmptyDataWarning(args.current === 0);
}
this._eventHandler.subscribe(dataView.onRowCountChanged, (_e: Event, args: any) => {
grid.invalidate();
this.handleOnItemsChanged(args.current || 0);
});

// Tree Data with Pagiantion is not supported, throw an error when user tries to do that
Expand Down Expand Up @@ -776,6 +771,21 @@ export class AngularSlickgridComponent implements AfterViewInit, OnDestroy, OnIn
}
}

/** When data changes in the DataView, we'll refresh the metrics and/or display a warning if the dataset is empty */
private handleOnItemsChanged(itemCount: number) {
this.metrics = {
startTime: new Date(),
endTime: new Date(),
itemCount: itemCount,
totalItemCount: Array.isArray(this.dataset) ? this.dataset.length : 0
};

// when using local (in-memory) dataset, we'll display a warning message when filtered data is empty
if (this._isLocalGrid && this.gridOptions && this.gridOptions.enableEmptyDataWarningMessage) {
this.displayEmptyDataWarning(itemCount === 0);
}
}

private initializePaginationService(paginationOptions: Pagination) {
if (this.gridOptions) {
this.paginationData = {
Expand Down