Using Length Menu

Using Length Menu

yishayhyishayh Posts: 108Questions: 17Answers: 0
edited August 2016 in DataTables 1.10

Hi Alan,

when using the length lengthMenu option:

tableOptions.lengthMenu = [
            [10,20,50,100,200,400],
            [10,20,50,100,200,400]
          ];

We used settings._iDisplayLength to get the selected length, and it worked most of the time, but there are cases where it doesn't work, are we using the wrong attribute?

Many thanks,
Yishay

Answers

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    settings._iDisplayLength

    The settings object should never be used. It is considered to be private. Its parameters can, will and do change between versions.

    Use page.len() to get the page length.

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    thanks as usual for these quick replies.
    We changed it to page.len(), but we still have a problem, because it returns the number of records in the table and not the selected param from the the lengthMenu menu (We have some filter capabilities that are operated outside the table itself).
    How can we get only the selected length from the lengthMenu without taking into account the length number of records actually in the table?

    Many thanks,
    Yishay

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    That's exactly what page.len() should do. If it isn't I'd need a link to a page showing the issue please.

    Allan

  • yishayhyishayh Posts: 108Questions: 17Answers: 0

    Hi Allan,

    it is in our private environment, I'll write you in private the details.

    Many thanks,
    Yishay

This discussion has been closed.