how to use oTable.fnDraw();it always go to the first page

how to use oTable.fnDraw();it always go to the first page

dreams1981dreams1981 Posts: 5Questions: 0Answers: 0
edited February 2011 in General
[code]
function Button2_onclick() {
var iCurrentPage = oTable.fnSettings()._iDisplayStart;
var oSettings = oTable.fnSettings();
oSettings._iDisplayStart = iCurrentPage;
oTable.fnDraw(oSettings);
}
[/code]
I add this code to the example "http://datatables.net/examples/basic_init/scroll_y_theme.html";
When I jump page 3 and click the "Button2",why it jumps to the first page not 3?

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    fnDraw without any parameters (you don't need to pass it oSettings btw) will do a full redraw - which is filtering and sorting. Since the sorting might have changed the draw will jump you back to the first page. You can pass false to do a basic draw, and there is also a standing re-draw plug-in if you want to do the filtering etc but remain on the same page: http://datatables.net/plug-ins/api#fnStandingRedraw .

    Allan
  • dreams1981dreams1981 Posts: 5Questions: 0Answers: 0
    when i use fnStandingRedraw.js, I get an error on page.'oFeatures is null or not an object'
  • dreams1981dreams1981 Posts: 5Questions: 0Answers: 0
    I got it,because the "Example call" still in the fnStandingRedraw.js file. thanks allan
This discussion has been closed.