| 8 |
lars |
1 |
/**
|
|
|
2 |
* Change the number of records that can be viewed on a single page in
|
|
|
3 |
* DataTables.
|
|
|
4 |
*
|
|
|
5 |
* DataTables 1.10 provides the `dt-api page.len()` method to get and set the
|
|
|
6 |
* page length using the built-in API. As such this method is marked deprecated,
|
|
|
7 |
* but is available for use with legacy version of DataTables. Please use the
|
|
|
8 |
* new API if you are used DataTables 1.10 or newer.
|
|
|
9 |
*
|
|
|
10 |
* @name fnLengthChange
|
|
|
11 |
* @summary Change the paging display length
|
|
|
12 |
* @author [Pedro Alves](http://www.webdetails.pt/)
|
|
|
13 |
* @deprecated
|
|
|
14 |
*
|
|
|
15 |
* @example
|
|
|
16 |
* $(document).ready(function() {
|
|
|
17 |
* var table = $('#example').dataTable();
|
|
|
18 |
* table.fnLengthChange( 100 );
|
|
|
19 |
* } );
|
|
|
20 |
*/
|
|
|
21 |
|
|
|
22 |
jQuery.fn.dataTableExt.oApi.fnLengthChange = function ( oSettings, iDisplay )
|
|
|
23 |
{
|
|
|
24 |
oSettings._iDisplayLength = iDisplay;
|
|
|
25 |
oSettings.oApi._fnCalculateEnd( oSettings );
|
|
|
26 |
|
|
|
27 |
/* If we have space to show extra rows (backing up from the end point - then do so */
|
|
|
28 |
if ( oSettings._iDisplayEnd == oSettings.aiDisplay.length )
|
|
|
29 |
{
|
|
|
30 |
oSettings._iDisplayStart = oSettings._iDisplayEnd - oSettings._iDisplayLength;
|
|
|
31 |
if ( oSettings._iDisplayStart < 0 )
|
|
|
32 |
{
|
|
|
33 |
oSettings._iDisplayStart = 0;
|
|
|
34 |
}
|
|
|
35 |
}
|
|
|
36 |
|
|
|
37 |
if ( oSettings._iDisplayLength == -1 )
|
|
|
38 |
{
|
|
|
39 |
oSettings._iDisplayStart = 0;
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
oSettings.oApi._fnDraw( oSettings );
|
|
|
43 |
|
|
|
44 |
if ( oSettings.aanFeatures.l )
|
|
|
45 |
{
|
|
|
46 |
$('select', oSettings.aanFeatures.l).val( iDisplay );
|
|
|
47 |
}
|
|
|
48 |
};
|