![]() |
VOOZH | about |
DataTables is jQuery plugin that can be used for adding interactive and advanced controls to HTML tables for the webpage. This also allows the data in the table to be searched, sorted, and filtered according to the needs of the user. The DataTable also exposes a powerful API that can be further used to modify how the data is displayed.
The lengthMenu option is used to specify the options that are available in the drop-down list that controls the number of rows that a single page will have when pagination is enabled. It can be specified with either a one-dimensional list that allows only specifying the number of rows or a two-dimensional list that allows specifying both the number of rows and the text that will be actually displayed in the drop-down list.
The length values specified have to be a positive number. Any negative value specified will display all available rows in the table and disable pagination.
Syntax:
{ lengthMenu: value }
Parameters: This option has a single value as mentioned above and described below:
The examples below illustrate the use of this option.
Example 1: In this example, a one-dimensional array is used to specify the options drop-down length.
Output:
👁 ImageExample 2: In this example, a two-dimensional array is used to specify the options drop-down length and the text that will be used for them.
Output:
👁 ImageReference: https://datatables.net/reference/option/lengthMenu