I tried to add
[deltaRowDataMode]="true"
to my grid and called
this.gridApi.setRowData(this.rowData);
but the code throws the error
ag-Grid: ImmutableService requires getRowNodeId() callback to be implemented, your row data need IDs!
push../projects/secdo-infra-lib/node_modules/ag-grid-community/dist/lib/rowModels/clientSide/immutableService.js.ImmutableService.createTransactionForRowData @ immutableService.js:38 push../projects/secdo-infra-lib/node_modules/ag-grid-community/dist/lib/gridApi.js.GridApi.setRowData @ gridApi.js:151
Looking this up online I have read that getRowNodeId is auto generated if not set so I don't understand why the error is thrown.
Row IDs are generated by the grid when data is supplied to the grid. The grid uses a sequence starting at 0 and incrementing by 1 to assign row IDs, so for example if there are three rows they will have IDs of 0 , 1 and 2 . The row ID does not change for a row once it is set.
To get the currently selected rows you can then use the grid API method getSelectedRows() to return a list of all the currently selected row data.
There is no option in the library to make a single row disabled(both visually and keyboard event based), the only way we could make a single row disabled is by using a customCellRenderer for both header and subsequent cell checkboxes, this allows full control over the checkbox.
Access the Grid & Column API You can access the APIs in the following ways: Store them from the gridReady event - they'll be available via the params argument passed into the event. Provide a gridOptions object to the grid pre-creation time. Post-creation the APIs will be available on the gridOptions object.
From the docs
For the deltaRowDataMode to work, you must be providing ID's for the row nodes by implementing the getRowNodeId() callback.
The grid works out the delta changes with the following rules:
IF the ID for the new item doesn't have a corresponding item already in the grid THEN it's an 'add'.
IF the ID for the new item does have a corresponding item in the grid THEN compare the object references. If the object references are different, it's an update, otherwise it's nothing (excluded from the transaction).
IF there are items in the grid for which there are no corresponding items in the new data, THEN it's a 'remove'.
You can implement getRowNodeId()
in a way that it returns unique ids for each row. e.g.
this.getRowNodeId = function(data) {
return data.id; //id is a field here
};
This official example has more details
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With