Skip to content
Advertisement

How to get a node by index in ag-grid?

AgGrid expects node(s) to be passed in to lot of it’s data functions. How do you get a node by index? Look at the snip below:

api.forEachNode(function(node){
   api.refreshRows([node]);
})

I can pass the node parameter to refreshRows() function since I’m getting it through forEachNode().

How do you get a node by index without iterating through forEachNode() ?

Advertisement

Answer

You can use getVirtualRow() method to get a single row. This function is a part of the Row Model. You can get the Row Model by getModel() function.

var model = api.getModel();
console.log(model.getVirtualRow(idx));
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement