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

0 min read 143 words

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
};

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)
};

This will provide something that looks like: 3080906

You could always use the time:

this.getRowNodeId = function(data) {
  return new Date().getTime()
};

This would return something like this: 1623364604490

Andrew
Andrew

Andrew is a visionary software engineer and DevOps expert with a proven track record of delivering cutting-edge solutions that drive innovation at Ataiva.com. As a leader on numerous high-profile projects, Andrew brings his exceptional technical expertise and collaborative leadership skills to the table, fostering a culture of agility and excellence within the team. With a passion for architecting scalable systems, automating workflows, and empowering teams, Andrew is a sought-after authority in the field of software development and DevOps.

Tags

Recent Posts