1

I'm using Infinite Row Model on Ag grid. And I need to be able to update the cellRenderer manually when changing the data on remote. I am currently using the purgeInfiniteCache () method. But it has a very noticeable blink. Would there be any way to update only the row? or update the cache only from the current view?

Jorge
  • 77
  • 4

1 Answers1

1

You could update the record in the cache by getting the rowNode using gridApi and then using updateData method of rowNode.

  rowNode = this.gridApi.getRowNode(`${updatedRecord.id}`);
  rowNode.updateData(updatedRecord);

However, if you are using this with infinite row model, you need to take care the data you are updating in the cache is same as that on the server. You can do this after receiving save/update success response from the server.

Paritosh
  • 11,144
  • 5
  • 56
  • 74
  • 1
    Those methods can not be used in "infinite row model". I also thought that! – Jorge Nov 02 '18 at 15:11
  • still, you can use it and update the viewport. It gives us warning on console (as it is not recommended), but that's how I avoided `purgeInfiniteCache` which was not accepted by UX (after making sure that the record is updated on server). – Paritosh Nov 02 '18 at 16:05
  • whenever the record goes out of the cache, the same updated record will be fetched from the server while loading data from `dataSource.getRows` - so there won't be any data integrity issue. – Paritosh Nov 02 '18 at 16:06
  • Its works, that updates the data. Thank you. But the cellRendererFramework is not updated, and that was my main problem. How can I pass the new data to the cellRender component and update it with that? – Jorge Nov 02 '18 at 20:17
  • or do you know some method to refresh only one row?, like purgeInfiniteCache() but only one row? – Jorge Nov 02 '18 at 20:27
  • Reproduce your issue on plunk or stackblitz. See how to create [move] – Paritosh Nov 04 '18 at 16:06
  • How can to use getFrameworkComponentInstance() to update data of my cellRenderer? – Jorge Nov 07 '18 at 16:00