change iDisplayLength

change iDisplayLength

dskrdskr Posts: 1Questions: 1Answers: 0

Hi,
im sorry to ask this again, but it just isn't working properly...

When i try to change the iDisplayLength like this:

    $(document).ready(function () {
        $('#example').dataTable({
            "iDisplayLength": 50
        });
    })

as explained here: https://datatables.net/forums/discussion/542/dynamically-change-idisplaylength

i just get the error message: "DataTables warning: table id=example - Cannot reinitialise DataTable. For more information about this error, please see http://datatables.net/tn/3"

Answers

  • allanallan Posts: 63,876Questions: 1Answers: 10,529 Site admin

    As the error message says you have already initialised the DataTable somewhere else. You have two options:

    1. Move all init options into the first initialisation of that table - see the docs.
    2. Use page.len() to dynamically set the page length.

    Allan

This discussion has been closed.