Click here to Skip to main content
14,921,612 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am creating grid using bootstrap which has search and paging option. The Grid table have Edit button. While clicking the edit button the page is redirect to another page on same controller. After updating the record the page should redirect to previous page which has the grid shown on the list. The problem is the client requirement is while returning grid page the grid shows the same paging and searching option. For example If the page is 2 nd inthe grid after updating the 2 nd page record and redirect the grid page should have 2 nd index page only.

What I have tried:

I can get the paging value from jquery. But the sessionstorage is not existing while redirecting page.
$('#tblpo').DataTable({
                       pageLength: 10,
                       "fnDrawCallback": function(oSettings) {

                           var tableinfp = $('#tblpo').DataTable();
                           var info = tableinfp.page.info();
                           sessionStorage.setItem('pageindex', info.page);
                           sessionStorage.setItem('pagelength', info.length);
                           sessionStorage.setItem('searchtext', tableinfp.search());

                       }

                  });
Posted
Updated 8-Dec-17 8:33am
v3

1 solution

Try using the stateSave[^] and stateDuration[^] options:
JavaScript
$('#tblpo').DataTable({
    pageLength: 10,
    stateSave: true,
    stateDuration: -1
});
   
Comments
Member 13542747 14-Dec-17 5:55am
   
This is working for me. Thanks alot for your kind reply

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900