Comments (8)
@ceolter Although this issue is closed, I was trying to determine the best way to handle my use case:
I have updated row data for a specific row from the backend server. I'd like to just update the row's data and call api.refreshRows([rowToRefresh])
.
However, the only way to locate the row is to call api.forEachNode
and find the matching node with id. However, once I find the correct row I can't event short circuit the forEachNode with a break
statement like a normal javascript array forEach
.
Do you still recommend just maintaining our own map to find rows based on Ids or is there another more clever way to just find a row based on it's id?
Thanks!
from ag-grid-enterprise.
i assume you are talking about cellRenderer? if yes, then node is passed as a param, and the id is in the node.
another way, which i don't recommend, but you might want, is to also use api.getBusinessKeyForNode(), that will put the id you give it into the DOM as an attribute to the row. you don't have to have it the same as the node id, but you can do if you decide.
from ag-grid-enterprise.
@ceolter I have the node id and want to get the node outside of the cellRenderer context. I would like a more efficient way to get the node object(maybe getNodeFromId in the gridApi) without having to use forEachNode and go through all the nodes. Is it possible or could it be implemented?
from ag-grid-enterprise.
nope - the only collection the grid has of the nodes is in the rowModel, which just keeps the nodes in a list. if you want to index by id, then i suggest you keep a map yourself? the grid doens't need it, so it's not a grid responsibility. given you are providing the nodeId's, then you have the perfect callback getRowNodeId
for populating your map.
from ag-grid-enterprise.
because the grid doesn't need it, it would be a wast of memory for the grid to keep such a map, given very few people (only one so far) has asked for it :)
from ag-grid-enterprise.
got it. Thank you for the response :). I will keep a node reference with my custom checkbox for now
from ag-grid-enterprise.
+1
from ag-grid-enterprise.
Is there a way to early exit/break from forEachNode loop once we find a satisfying node?
return statement doesn't work inside forEachNode()
from ag-grid-enterprise.
Related Issues (20)
- Importing ag-grid-enterprise causes column definition comparators to be called with missing arguments. HOT 1
- group header display unexpected with both valueGetter and aggFunc HOT 1
- "beforeReady" prop HOT 1
- Is there any option to add multiple details grid under one master grid (Grouping -Master / Detail) ? HOT 1
- Server side row model grid is not emiting events with high number of total rows
- Link is Invalid HOT 1
- Blank filter rows are not rendered HOT 1
- ColumnsMenuTab Gets Removed After Refresh HOT 1
- FilterModel gets reset when user types case insensitive value HOT 1
- FillOperation callback should always be passed column and rowNode for current cell HOT 1
- FillOperation callback should be provided with the proposed new fill value HOT 1
- Uncaught Error: AG Grid - Illegal version string: 27.1.0 (RestoreChart) HOT 2
- Last sparkline tooltip renderer overrides others HOT 2
- Grouping: Group a column of arrays by each item. (Example, Group by Tags where cellValue=[a, b, c] and it should group by a, b, and c) HOT 1
- Comparators not working as expected on grouped columns HOT 1
- when i am setting :rowData="rowData" in ag grid setRowData is not working and when removing :rowData="rowData" setRowData is working fine why HOT 1
- CSV Injection vulnerability HOT 1
- Upgrading to 28 not working with esbuild HOT 1
- Not Equals filter operation not working with tree data Ag Grid(27.3.0) HOT 1
- Custom Pagination serverside not working HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ag-grid-enterprise.