language.lengthLabels
Specify the labels for the page length dropdown.
Description
This option can be used to provide labels for the pageLength
dropdown entries. Properties in the object should be integers, and will be used if an entry from pageLength.menu
/ lengthMenu
matches the property key.
Generally it is expected that the only property to be defined will be -1
(for showing all records in the table), and indeed this is the only value set by default, however all options used in the dropdown could be specified if you wished to have a custom label for each.
If there is no matching entry in this object for a specific page length, the value will be used instead, or the label
if specified using pageLength.menu
with a label
/value
object.
Type
This option can be given in the following type(s):
Default
- Value:
{'-1': 'All'}
Examples
Setting Show all
as the text for all records option:
new DataTable('#myTable', {
language: {
lengthLabels: {
'-1': 'Show all'
}
},
lengthMenu: [10, 25, 50, -1]
});
Specifying location with layout
:
new DataTable('#myTable', {
language: {
lengthLabels: {
'-1': 'Show all'
}
},
layout: {
topStart: {
pageLength: {
menu: [10, 25, 50, -1]
}
}
}
});
Related
The following options are directly related and may also be useful in your application development.