how to reload the data in data table in Webix?

9.6k views Asked by At

Given data to the data table, saved its state as originalState.

webix.storage.local.put(datatable.getState());

updated sorting to column & reverted the state to its originalState.

var state = webix.storage.local.get("originalState");
if (state) {
   datatable.setState(state);
}

Every thing is working fine(like column re-ordering, size) but the data that was sorted earlier is not being reset to its original data. Still its is showing the sorted data only. Tried refresh() but still it is same.

2

There are 2 answers

2
Aquatic On BEST ANSWER

There is no way to revert table back to unsorted state You can apply some saved sorting, but you can not "unsort" the table.

table.refresh() will only repaint the data in the datatable, it doesn't have any other means If you need a real data reloading from remote datasource, you need to use

table.clearAll()
table.load(data_url);
1
Tony On

I do not know if it is possible to recharge.

I found an example that can help you.

When you "restore state", also ensures the sorting:

 function restore_state() {
        var state = webix.storage.local.get("state");
        if (state){
            grid.setState(state);   
            grid.sort("#rank#");
            grid.markSorting("rank", "asc");
        }
    }