3
votes

Overview

Formerly in ag-grid version <10.1.0 a row could be added without refreshing the grid in this way:

let model: IRowModel = this.gridOptions.api.getModel();
const skipRefresh = true;

model.addItems( [ obj ], skipRefresh );

Since ag-grid 10.1.0 the addItems() method is deprecated and has been removed completely. The documentation says to use updateRowData() instead:

this.gridOptions.api.updateRowData( { add: [ obj ] } );

The problem is that updateRowData() does always refresh the grid. That drags down the performance of our grid extremely.

Question

How do I add rows without having the grid refreshed automatically in current ag-grid version?

What I've already tried

Suppressing ag-grid's new change detection by setting suppressChangeDetection=true That didn't help. Refresh is still done.

2
It seems to be no more possible to do this since 10.1.0. I've added an issue here: github.com/ag-grid/ag-grid/issues/2116 - Seeschorle

2 Answers

1
votes

The problem is that updateRowData() does always refresh the grid." This is not true. api.updateRowData() does not trigger a full refresh. there must be something else you are doing that is causing this.

0
votes

Old one, but since I came across it while searching and figuring out the answer, this might help someone

this.myGrid.api.addItems([myItem])