Fixing: ImmutableService requires getRowNodeId() callback to be implemented, your row data need IDs

If you have gotten this error before, then you have been trying to implement a rowData mapping onto Ag-Grid.. and failed!

ImmutableService requires getRowNodeId() callback to be implemented, your row data need IDs

How to fix the ‘Your row data need IDs’ error

The good thing, is that it’s actually quite an easy fix:

Make sure that you have implemented the getRowNodeId function to return an actual id:

this.getRowNodeId = function(data) { return data.id; //id is a field here };
Code language: JavaScript (javascript)

Worst case scenario, you could always return a random number here, but that is not recommended; but it certainly does help if you’re in a sticky situation:

this.getRowNodeId = function(data) { return Math.round(Math.random()*10000000) };
Code language: JavaScript (javascript)

This will provide something that looks like: 3080906

You could always use the time:

this.getRowNodeId = function(data) { return new Date().getTime() };
Code language: JavaScript (javascript)

This would return something like this: 1623364604490

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments