Display the number of records in length menu

Display the number of records in length menu

BojanBojan Posts: 1Questions: 1Answers: 0
edited February 2022 in DataTables

How can i insert the number of records as an option in the lengthMenu.

e.g if there are 15 records show 15 as an available option in the lengthMenu.

lengthMenu': [[8, -1], [8, 15]]

Answers

  • kthorngrenkthorngren Posts: 17,759Questions: 25Answers: 4,216

    I don't believe there is a built in way to dynamically set the length values based on the number of rows. You could use a little jQuery magic to update the lengthMenu in initComplete to change value All, for example, to the number of rows. Use the page.info() to get the total number of rows.

    Kevin

Sign In or Register to comment.