5

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.

Phil Dukhov
  • 67,741
  • 15
  • 184
  • 220
balusu
  • 367
  • 3
  • 10

2 Answers2

12

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);
Aquatic
  • 5,084
  • 3
  • 24
  • 28
  • This worked well for me, except i dont' want to defind the url 2 times. Is it possible to access the table config? like: table.load(table.url); – Phaedrus Mar 09 '15 at 14:27
  • 4
    Yep, you can use `table.load( table.config.url );` – Aquatic Mar 09 '15 at 17:14
1

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");
        }
    }
Tony
  • 91
  • 4
  • @Tony : I am facing the same problem.Even I too tried it its not working.Any other suggestions will be appreciated. – Monish Kumar Dec 02 '14 at 08:32