最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - how to reload the data in data table in Webix? - Stack Overflow

programmeradmin5浏览0评论

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.

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.

Share Improve this question edited Jul 28, 2023 at 3:42 Phil Dukhov 88k21 gold badges257 silver badges288 bronze badges asked Nov 26, 2014 at 5:08 balusubalusu 3771 gold badge3 silver badges10 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 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);

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");
        }
    }
发布评论

评论列表(0)

  1. 暂无评论