Is there a way to force a single row update using SlickGrid?

I have an amazing SlickGrid designed to asynchronously access data and resubmit user messages to the server asynchronously. In general terms, a server can modify multiple row fields based on user changes. Thus, after updating the row, I would like SlickGrid to update only this row without changing the rest of the view.

Does anyone know how to do this?

In my case, the field that changes on the server is the timestamp associated with the record, which is updated by the database trigger. If the timestamp is out of date, the user has an old copy of the data, and if they send the changes, they can overwrite the new copy. Since I cannot find a way to initiate the update, the user cannot change his own changes without updating the browser window (forcing a full update).

+4
source share
2 answers

You must do this using grid.invalidateRow() and grid.render() . SlickGrid will re-display the linked cells (provided that they are displayed in the currently visible viewport) without refreshing the entire page.

 // Mark row 42 as changed and re-render the display grid.invalidateRow(42); grid.render(); 

As an example, consider Example 14 of SlickGrid . (Click the Start Simulation button to see it in action)

+6
source
 function updateSlickgrid() { dataView.setItems(tableName); grid.invalidate(); } 

Note : tableName can be an array or an identifier, etc. I prefer to store all slickgrid data in an array ex tableName = [];

Keep using the above function when it comes to displaying data in slickgrid

0
source

Source: https://habr.com/ru/post/1446338/


All Articles