Updating SSRM nodes locally
The following example demonstrates CRUD operations by looping over loaded row nodes, using api.forEachNode(), and updating the data using: rowNode.setData(data)
'Update Selected Rows’ - here we just locate the selected row nodes and update the data on them directly.
'Delete Selected Rows’ - deletion is achieved by iteratively swapping the data into the previously found row to delete. Note that this will leave blank rows when the number of rows is less than the block size.
'Add Row After Selected’ - this follows a similar approach to deletion were we are swapping data between into existing row nodes to achieve the appearance of addition.
It’s important to note that setting row data will NOT change the row node ID - so if using getRowNodeId() and the data changes such that the ID will be different, the rowNode will not have it's ID updated!
The example also include some mock server endpoints to update / delete / add data on the server once the grid has been updated.
You can observe the results by invoking 'Purge Caches'
Note that the group viewport won't resize until the user purges the cache, so this example has limitations but show a possible way to accomplish this
Comments
1 comment
Thank You for attached example, but it's not sufficient for Us.
Your code doesn't add new row, but only swaps existing.
If I have 5 rows displayed and I add 1, then I would still have 5 rows displayed, but one with new data.
Isn't there a possibility to add a row?
Please sign in to leave a comment.