1

I am adding a new row at the top of an existing ag-grid with this code

function addRow() {
  let lastrow = gridOptions.api.getDisplayedRowAtIndex(gridOptions.api.getLastDisplayedRow());
 gridOptions.api.applyTransaction({add:[lastrow.data], addIndex:0});
}

this works. I then want to edit the cells which I do by double clicking on each cell. Every time I press enter, it calls the grid callback

onCellEditingStopped: function(event) {
  const rowNode = gridOptions.api.getRowNode(event.rowIndex);
}

I noticed that when it calls onCellEditingStoppedand tries to get the rowNode it always returns the row that was on top before I added the new row (that initial row is now the second row).

What am I doing wrong?

user2175783
  • 1,291
  • 1
  • 12
  • 28

1 Answers1

1

you can tries the 'onCellValueChanged' instead 'onCellEditingStopped'

Reza Esmaeli
  • 146
  • 7