page.info().start is incorrect on preDraw

page.info().start is incorrect on preDraw

StadlyStadly Posts: 1Questions: 1Answers: 0

Link to test case: https://codepen.io/Stadly/pen/RwgweWV
Debugger code (debug.datatables.net): https://debug.datatables.net/agiruc
Error messages shown: None
Description of problem:

During the preDraw event, the page.info().start is not reliable.

Is there a reason for this, or is it a bug?

$(document).ready(function() {
  $('#example').DataTable({
    "displayStart": 10,
    "preDrawCallback": function(settings) {
      console.log(this.api().page.info().start); // 0 (incorrect)
    },
    "drawCallback": function(settings) {
      console.log(this.api().page.info().start); // 10 (correct)
    }
  });
});

See the test case for details.

Answers

  • allanallan Posts: 54,680Questions: 1Answers: 8,552 Site admin

    It is before the draw, so the parameters haven't fully been set. What is your goal here?

    Allan

Sign In or Register to comment.