Many similar questions here, but I'm unable to find a solution to my basic requirement.
I'm using ag-grid in React in the Infinite Row model. Data are loaded from server by blocks of 100.
I would like to preselect a row - for example row id 500. This requires loading the right block and, once loaded, then selecting the right node.
Example here: (click on Jump to 500 button) demo code
const jumpTo500 = () => {
if (gridApi.getInfiniteRowCount() < 501) {
gridApi.setRowCount(501, false);
}
gridApi.ensureIndexVisible(500, 'middle');
gridApi.forEachNode((node) => {
if (node.rowIndex === 499) {
node.setSelected(true);
}
});
};
Right now I need to click twice on the button because I try to select to row before the node is loaded.
Question: How to know when the grid is rendered and the new nodes are loaded?
onRowDataChanged() and onRowDataUpdated() events are never called.