mirror of
https://github.com/DataTables/DataTables.git
synced 2024-11-29 11:24:10 +01:00
New: Pagination language options (i18n) have _PAGE_ and _PAGES_ options
- Based on the discussion in forum thread 16938 DataTables now has the ability to use _PAGE_ and _PAGES_ in addition to the exisiting _START_, _END_, _MAX_ and _TOTAL_ options in the information language strings. This allows the developer to show paging information rather than record based information in the information element.
This commit is contained in:
parent
425eb38c5b
commit
e6840bd2cf
@ -1 +1 @@
|
||||
ad25f79e7614164e30d030d7bcc295ccd8833f7c
|
||||
04be76a50f2e29d12369faaee03bacb29b92592a
|
||||
|
32
media/js/jquery.dataTables.js
vendored
32
media/js/jquery.dataTables.js
vendored
@ -2583,14 +2583,19 @@
|
||||
// When infinite scrolling, we are always starting at 1. _iDisplayStart is used only
|
||||
// internally
|
||||
var
|
||||
start = settings.oScroll.bInfinite ? 1 : settings._iDisplayStart+1,
|
||||
formatter = settings.fnFormatNumber;
|
||||
formatter = settings.fnFormatNumber,
|
||||
start = settings.oScroll.bInfinite ? 1 : settings._iDisplayStart+1,
|
||||
len = settings._iDisplayLength,
|
||||
vis = settings.fnRecordsDisplay(),
|
||||
all = len === -1;
|
||||
|
||||
return str.
|
||||
replace(/_START_/g, formatter.call( settings, start ) ).
|
||||
replace(/_END_/g, formatter.call( settings, settings.fnDisplayEnd() ) ).
|
||||
replace(/_TOTAL_/g, formatter.call( settings, settings.fnRecordsDisplay() ) ).
|
||||
replace(/_MAX_/g, formatter.call( settings, settings.fnRecordsTotal() ) );
|
||||
replace(/_MAX_/g, formatter.call( settings, settings.fnRecordsTotal() ) ).
|
||||
replace(/_TOTAL_/g, formatter.call( settings, vis ) ).
|
||||
replace(/_PAGE_/g, formatter.call( settings, all ? 1 : Math.ceil( start / len ) ) ).
|
||||
replace(/_PAGES_/g, formatter.call( settings, all ? 1 : Math.ceil( vis / len ) ) );
|
||||
}
|
||||
|
||||
|
||||
@ -10500,10 +10505,19 @@
|
||||
|
||||
|
||||
/**
|
||||
* This string gives information to the end user about the information that
|
||||
* is current on display on the page. The _START_, _END_ and _TOTAL_
|
||||
* variables are all dynamically replaced as the table display updates, and
|
||||
* can be freely moved or removed as the language requirements change.
|
||||
* This string gives information to the end user about the information
|
||||
* that is current on display on the page. The following tokens can be
|
||||
* used in the string and will be dynamically replaced as the table
|
||||
* display updates. This tokens can be placed anywhere in the string, or
|
||||
* removed as needed by the language requires:
|
||||
*
|
||||
* * `\_START\_` - Display index of the first record on the current page
|
||||
* * `\_END\_` - Display index of the last record on the current page
|
||||
* * `\_TOTAL\_` - Number of records in the table after filtering
|
||||
* * `\_MAX\_` - Number of records in the table without filtering
|
||||
* * `\_PAGE\_` - Current page number
|
||||
* * `\_PAGES\_` - Total number of pages of data in the table
|
||||
*
|
||||
* @type string
|
||||
* @default Showing _START_ to _END_ of _TOTAL_ entries
|
||||
*
|
||||
@ -10514,7 +10528,7 @@
|
||||
* $(document).ready( function() {
|
||||
* $('#example').dataTable( {
|
||||
* "language": {
|
||||
* "info": "Got a total of _TOTAL_ entries to show (_START_ to _END_)"
|
||||
* "info": "Showing page _PAGE_ of _PAGES_"
|
||||
* }
|
||||
* } );
|
||||
* } );
|
||||
|
Loading…
Reference in New Issue
Block a user