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 @@ -209,6 +209,7 @@ const mockDataView = {
destroy: jest.fn(),
beginUpdate: jest.fn(),
endUpdate: jest.fn(),
getFilteredItemCount: jest.fn(),
getItem: jest.fn(),
getItems: jest.fn(),
getItemCount: jest.fn(),
Expand Down Expand Up @@ -1839,6 +1840,7 @@ describe('Angular-Slickgrid Custom Component instantiated via Constructor', () =
totalItemCount: 2
};
jest.spyOn(mockDataView, 'getItemCount').mockReturnValue(mockData.length);
jest.spyOn(mockDataView, 'getFilteredItemCount').mockReturnValue(mockData.length);

component.gridOptions = { enablePagination: false, showCustomFooter: true };
component.initialization(slickEventHandler);
Expand All @@ -1854,10 +1856,10 @@ describe('Angular-Slickgrid Custom Component instantiated via Constructor', () =
const expectation = {
startTime: expect.toBeDate(),
endTime: expect.toBeDate(),
itemCount: 2,
itemCount: 0,
totalItemCount: 0
};
jest.spyOn(mockDataView, 'getLength').mockReturnValue(2);
jest.spyOn(mockDataView, 'getFilteredItemCount').mockReturnValue(0);

component.gridOptions = { enablePagination: false, showCustomFooter: true };
component.initialization(slickEventHandler);
Expand Down Expand Up @@ -1885,6 +1887,7 @@ describe('Angular-Slickgrid Custom Component instantiated via Constructor', () =

component.gridOptions.enableCheckboxSelector = true;
component.gridOptions.presets = { rowSelection: { dataContextIds: selectedRowIds } };
component.isDatasetInitialized = false;
component.initialization(slickEventHandler);
component.dataset = mockData;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -923,11 +923,11 @@ export class AngularSlickgridComponent implements AfterViewInit, OnDestroy {
const onRowCountChangedHandler = dataView.onRowCountChanged;
(this._eventHandler as SlickEventHandler<GetSlickEventType<typeof onRowCountChangedHandler>>).subscribe(onRowCountChangedHandler, (_e, args) => {
grid.invalidate();
this.handleOnItemCountChanged(args.current || 0, dataView.getItemCount());
this.handleOnItemCountChanged(this.dataView.getFilteredItemCount() || 0, dataView.getItemCount());
});
const onSetItemsCalledHandler = dataView.onSetItemsCalled;
(this._eventHandler as SlickEventHandler<GetSlickEventType<typeof onSetItemsCalledHandler>>).subscribe(onSetItemsCalledHandler, (_e, args) => {
this.handleOnItemCountChanged(dataView.getLength(), args.itemCount);
this.handleOnItemCountChanged(this.dataView.getFilteredItemCount() || 0, args.itemCount);

// when user has resize by content enabled, we'll force a full width calculation since we change our entire dataset
if (args.itemCount > 0 && (this.gridOptions.autosizeColumnsByCellContentOnFirstLoad || this.gridOptions.enableAutoResizeColumnsByCellContent)) {
Expand Down