Prevent the jquery datatable to restore to initial state when clicking the toggle button

Prevent the jquery datatable to restore to initial state when clicking the toggle button

pradeepshankarpradeepshankar Posts: 2Questions: 1Answers: 1
edited October 2014 in Free community support

Here I have a bootstrap styled fixed column datatable where i can toggle the columns by a button as,

 $('#ToggleColumns').click(function () { 
      table.destroy();
  if(columnNumber == 2)
  {
columnNumber = 0;  
  }
  else {
  columnNumber = 2; 
  }
  });

If I am at the 3rd page of datatable pagination and when I toggling the columns, the table restores to its initial position. ie, first page. How can I prevent it and be there in the 3rd page itself after toggling? The same applies to the no. of record selection too.

This discussion has been closed.