fnUpdate when run while on a page other than 1 of a multi-page table causes the page to reset back 1

fnUpdate when run while on a page other than 1 of a multi-page table causes the page to reset back 1

ZxurianZxurian Posts: 26Questions: 6Answers: 0
edited March 2012 in DataTables 1.9
as title says, if a table has 40 rows, and the current pagination is 10 rows at a time, if you are on page 2, 3, or 4, and perform a .fnUpdate() call to update the table cell data, it causes the table to reset back to page 1. Is there any way to avoid this?

Replies

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    This is caused by the fact that the table is fully redrawn to take account of the new data (i.e. resorted and refiltered), which will set the paging back to page one. The way to have it not do this is to set parameter 4 that you give to fnUpdate to false (i.e. don't do a redraw) and use the standing redraw plug-in: http://datatables.net/plug-ins/api#fnStandingRedraw

    Allan
  • ZxurianZxurian Posts: 26Questions: 6Answers: 0
    ah ha. Thank you. I was utilizing the 4th parameter when doing multiple table edits, but didn't know there was a plugin to accomplish that. my google-fu is lacking.

    thanks!
  • gsipesgsipes Posts: 1Questions: 0Answers: 0
    I had this same issue and solved it with fnStandingRedraw. Thanks for the explanation Allen, simple enough fix!
This discussion has been closed.