Hello @kchhatani ,
First of all, I want to mention that Webix datatable provides a possibility to store/restore the state of the grid to cookie, local or session storage.
The state object will contain information about the current datatable state including IDs of currently selected items (each ID is an object with row, column and id properties)
To save the current datatable state to the local storage you should call the getState method as in:
var state = grid.getState();
webix.storage.local.put("state", state);
To restore the saved state you should call the setState method:
var state = webix.storage.local.get("state");
if (state)
grid.setState(state);
More information you can find here
If the id comes from server(which a random id) or data comes without id (so getting webix.uid()) - the solution will be different. With the help of unload it’s possible to store the item and look for it by attributes via find()
Like this:
// before unload
webix.attachEvent("unload", function(){
webix.storage.local.put("selected_obj", grid.getSelectedId());
});
// after init
var obj = webix.storage.local.get("selected_obj");
if (obj){
var item_id = grid.find(/* find ID by other properties */)
if (item_id)
grid.select(item_id);
}