lengthMenu

Since: DataTables 1.10

Change the options in the page length select list.

Description

This parameter allows you to readily specify the entries in the length drop down select list that DataTables shows when pagination is enabled. It can be either:

  • 1D array of integer values which will be used for both the displayed option and the value to use for the display length, or

  • 2D array which will use the first inner array as the page length values and the second inner array as the displayed options. This is useful for language strings such as 'All').

The page length values must always be integer values > 0, with the sole exception of -1. When -1 is used as a value this tells DataTables to disable pagination (i.e. display all rows).

Note that the pageLength property will be automatically set to the first value given in this array, unless pageLength is also provided.

Type

This option can be given in the following type(s):

Default

[ 10, 25, 50, 100 ]

Examples

Show options 10, 25, 50, 75 and 100 records:

$('#example').dataTable( {
  "lengthMenu": [ 10, 25, 50, 75, 100 ]
} );

Show options 10, 25, 50 and all records:

$('#example').dataTable( {
  "lengthMenu": [ [10, 25, 50, -1], [10, 25, 50, "All"] ]
} );

Related

The following options are directly related and may also be useful in your application development.