2

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?

Luzan Baral
  • 3,678
  • 5
  • 37
  • 68
Morteza QorbanAlizade
  • 1,520
  • 2
  • 19
  • 35

2 Answers2

1

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

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

Just add an id attribute to the <table> element, like <table id="xxx" datatable>.

Rosty Kerei
  • 1,014
  • 1
  • 9
  • 16