简体   繁体   中英

Angularjs dataTable stateSave not woking on change routes

I'm using AngularJS datatable and enable save state with .withOption('stateSave', true) .

when I refresh the page, everything works fine But when I change routes, and came back, stateSave not working.


I found that , At each route change, datatable create a localStorage to save current table state with difference key ! so when change route, saveState not working.

How can I solve the problem?

只需向<table>元素添加一个id属性,例如<table id="xxx" datatable>

Add an attribute id into the table. And add the following code into your angularjs controller

$scope.vm.dtOptions = DTOptionsBuilder.newOptions()
    .withOption('stateSave', true);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM