mirror of
https://github.com/DataTables/DataTables.git
synced 2025-01-18 11:52:11 +01:00
Update: If aLengthMenu is given, but iDisplayLength is not, DataTables used to default to using the built in iDisplayLength option. However, this lead to a bit of confusion as to why the first value from aLengthMenu was not used (issue #61 and numerous forum posts). This commit changes that behaviour - the first value from aLengthMenu is used, if iDisplayLength is not given as well.
This commit is contained in:
parent
823e64cccb
commit
36fc3cc92e
21
media/js/jquery.dataTables.js
vendored
21
media/js/jquery.dataTables.js
vendored
@ -6180,6 +6180,13 @@
|
||||
_fnLanguageCompat( oInit.oLanguage );
|
||||
}
|
||||
|
||||
// If the length menu is given, but the init display length is not, use the length menu
|
||||
if ( oInit.aLengthMenu && ! oInit.iDisplayLength )
|
||||
{
|
||||
oInit.iDisplayLength = $.isArray( oInit.aLengthMenu[0] ) ?
|
||||
oInit.aLengthMenu[0][0] : oInit.aLengthMenu[0];
|
||||
}
|
||||
|
||||
oInit = _fnExtend( $.extend(true, {}, DataTable.defaults), oInit );
|
||||
|
||||
// Map the initialisation options onto the settings object
|
||||
@ -7635,6 +7642,9 @@
|
||||
* option and the value, or a 2D array which will use the array in the first
|
||||
* position as the value, and the array in the second position as the
|
||||
* displayed options (useful for language strings such as 'All').
|
||||
*
|
||||
* Note that the `displayLength` property will be automatically set to the
|
||||
* first value given in this array, unless `displayLength` is also provided.
|
||||
* @type array
|
||||
* @default [ 10, 25, 50, 100 ]
|
||||
*
|
||||
@ -7647,17 +7657,6 @@
|
||||
* "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]]
|
||||
* } );
|
||||
* } );
|
||||
*
|
||||
* @example
|
||||
* // Setting the default display length as well as length menu
|
||||
* // This is likely to be wanted if you remove the '10' option which
|
||||
* // is the displayLength default.
|
||||
* $(document).ready( function() {
|
||||
* $('#example').dataTable( {
|
||||
* "displayLength": 25,
|
||||
* "lengthMenu": [[25, 50, 100, -1], [25, 50, 100, "All"]]
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"aLengthMenu": [ 10, 25, 50, 100 ],
|
||||
|
||||
|
@ -88,6 +88,13 @@ if ( oInit.oLanguage )
|
||||
_fnLanguageCompat( oInit.oLanguage );
|
||||
}
|
||||
|
||||
// If the length menu is given, but the init display length is not, use the length menu
|
||||
if ( oInit.aLengthMenu && ! oInit.iDisplayLength )
|
||||
{
|
||||
oInit.iDisplayLength = $.isArray( oInit.aLengthMenu[0] ) ?
|
||||
oInit.aLengthMenu[0][0] : oInit.aLengthMenu[0];
|
||||
}
|
||||
|
||||
oInit = _fnExtend( $.extend(true, {}, DataTable.defaults), oInit );
|
||||
|
||||
// Map the initialisation options onto the settings object
|
||||
|
@ -143,6 +143,9 @@ DataTable.defaults = {
|
||||
* option and the value, or a 2D array which will use the array in the first
|
||||
* position as the value, and the array in the second position as the
|
||||
* displayed options (useful for language strings such as 'All').
|
||||
*
|
||||
* Note that the `displayLength` property will be automatically set to the
|
||||
* first value given in this array, unless `displayLength` is also provided.
|
||||
* @type array
|
||||
* @default [ 10, 25, 50, 100 ]
|
||||
*
|
||||
@ -155,17 +158,6 @@ DataTable.defaults = {
|
||||
* "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]]
|
||||
* } );
|
||||
* } );
|
||||
*
|
||||
* @example
|
||||
* // Setting the default display length as well as length menu
|
||||
* // This is likely to be wanted if you remove the '10' option which
|
||||
* // is the displayLength default.
|
||||
* $(document).ready( function() {
|
||||
* $('#example').dataTable( {
|
||||
* "displayLength": 25,
|
||||
* "lengthMenu": [[25, 50, 100, -1], [25, 50, 100, "All"]]
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"aLengthMenu": [ 10, 25, 50, 100 ],
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user