I have a case where I need to update grid cell value via "editable" cell and via external action (programatically). On every update (regardless the source) I would like to call a callback (API call to sync data with backend).
For update through editable cell the callback I am using is valueSetter.
Programatically I am updating a cell value using applyTransaction. However applyTransaction doesn't call valueSetter.
I have extracted exactly the case to show the problem:
https://codesandbox.io/p/sandbox/ag-grid-modules-tsp64f?file=%2Fsrc%2Findex.tsx
So my questions are:
- What's the pattern to have a common callback for both cases?
- Why
applyTransactionis moving the row to the bottom of the table? (https://monosnap.com/file/dACiTbQ7wjj4aoBbZBwg5sRpgFOfQY)
To answer your questions:
The pattern I'd go for is to call your
valueSetteron the column when you edit the cell via the button. You can do this by retrieving the column and executing thevalueSetteron the column like this:Your
getRowIdfunction was always returning undefined. This function takes the parameterparamsfrom which you can then get your id like this:Demo.