Length Menu outside datatable

Length Menu outside datatable

haonoyhaonoy Posts: 5Questions: 2Answers: 0

I have Select option and I need Length Menu link my select option.

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Use page.len() to set the page length using the API.

    Allan

  • haonoyhaonoy Posts: 5Questions: 2Answers: 0

    var oTable = $("example").DataTable();

    oTable.page.len(50).draw(); //not working

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Works for me: http://live.datatables.net/nopatod/1/edit . Please link to a test case, showing the issue.

    Allan

  • haonoyhaonoy Posts: 5Questions: 2Answers: 0

    I using

    var oSettings = oTable.fnSettings();
    oSettings._iDisplayLength = parseInt($('#lengthChange').val());
    oTable.fnPageChange("first");

    It's work.

    -Thanks-

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Fair enough, although you are modifying internal values there which I would very strongly recommend against. I guess you are using an old version of DataTables?

    Allan

  • haonoyhaonoy Posts: 5Questions: 2Answers: 0

    I using 1.10.0 version of DataTables

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    In which case I would suggest you use the page() API method. Don't use private methods, there is no telling what will happen.

    Failing that, please provide a test case as requested.

    Allan

This discussion has been closed.