Classes (0) | Namespaces (2) |
Properties (0) | Static properties (12) |
Methods (0) | Static methods (0) |
Events (0) |
Properties (0) | Static properties (12) |
Methods (0) | Static methods (0) |
Events (0) |
All strings that DataTables uses in the user interface that it creates are defined in this object, allowing you to modified them individually or completely replace them all as required.
Strings that are used for WAI-ARIA labels and controls only (these are not actually visible on the page, but will be read by screenreaders, and thus must be internationalised as well).
Pagination string used by DataTables for the two built-in pagination control types ("two_button" and "full_numbers")
This string is shown in preference to sZeroRecords when the table is empty of data (regardless of filtering). Note that this is an optional parameter - if it is not given, the value of sZeroRecords will be used instead (either the default or given value).
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.
Display information string for when the table is empty. Typically the format of this string should match sInfo.
When a user filters the information in a table, this string is appended to the information (sInfo) to give an idea of how strong the filtering is. The variable MAX is dynamically updated.
If can be useful to append extra information to the info string at times, and this variable does exactly that. This information will be appended to the sInfo (sInfoEmpty and sInfoFiltered in whatever combination they are being used) at all times.
DataTables has a build in number formatter (fnFormatNumber) which is used to format large numbers that are used in the table information. By default a comma is used, but this can be trivially changed to any character you wish with this parameter.
Detail the action that will be taken when the drop down menu for the pagination length option is changed. The 'MENU' variable is replaced with a default select list of 10, 25, 50 and 100, and can be replaced with a custom select box if required.
When using Ajax sourced data and during the first draw when DataTables is gathering the data, this message is shown in an empty row in the table to indicate to the end user the the data is being loaded. Note that this parameter is not used when loading data by server-side processing, just Ajax sourced data with client-side processing.
Text which is displayed when the table is processing a user action (usually a sort command or similar).
Details the actions that will be taken when the user types into the filtering input text box. The variable "INPUT", if used in the string, is replaced with the HTML text box for the filtering input allowing control over where it appears in the string. If "INPUT" is not given then the input box is appended to the string automatically.
All of the language information can be stored in a file on the server-side, which DataTables will look up if this parameter is passed. It must store the URL of the language file, which is in a JSON format, and the object has the same properties as the oLanguage object in the initialiser object (i.e. the above parameters). Please refer to one of the example language files to see how this works in action.
Text shown inside the table records when the is no information to be displayed after filtering. sEmptyTable is shown when there is simply no information in the table at all (regardless of filtering).
This string is shown in preference to sZeroRecords when the table is empty of data (regardless of filtering). Note that this is an optional parameter - if it is not given, the value of sZeroRecords will be used instead (either the default or given value).
$(document).ready( function() { $('#example').dataTable( { "oLanguage": { "sEmptyTable": "No data available in table" } } ); } );
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.
$(document).ready( function() { $('#example').dataTable( { "oLanguage": { "sInfo": "Got a total of _TOTAL_ entries to show (_START_ to _END_)" } } ); } );
Display information string for when the table is empty. Typically the format of this string should match sInfo.
$(document).ready( function() { $('#example').dataTable( { "oLanguage": { "sInfoEmpty": "No entries to show" } } ); } );
When a user filters the information in a table, this string is appended to the information (sInfo) to give an idea of how strong the filtering is. The variable MAX is dynamically updated.
$(document).ready( function() { $('#example').dataTable( { "oLanguage": { "sInfoFiltered": " - filtering from _MAX_ records" } } ); } );
If can be useful to append extra information to the info string at times, and this variable does exactly that. This information will be appended to the sInfo (sInfoEmpty and sInfoFiltered in whatever combination they are being used) at all times.
$(document).ready( function() { $('#example').dataTable( { "oLanguage": { "sInfoPostFix": "All records shown are derived from real information." } } ); } );
DataTables has a build in number formatter (fnFormatNumber) which is used to format large numbers that are used in the table information. By default a comma is used, but this can be trivially changed to any character you wish with this parameter.
$(document).ready( function() { $('#example').dataTable( { "oLanguage": { "sInfoThousands": "'" } } ); } );
Detail the action that will be taken when the drop down menu for the pagination length option is changed. The 'MENU' variable is replaced with a default select list of 10, 25, 50 and 100, and can be replaced with a custom select box if required.
// Language change only $(document).ready( function() { $('#example').dataTable( { "oLanguage": { "sLengthMenu": "Display _MENU_ records" } } ); } );
// Language and options change $(document).ready( function() { $('#example').dataTable( { "oLanguage": { "sLengthMenu": 'Display records' } } ); } );
When using Ajax sourced data and during the first draw when DataTables is gathering the data, this message is shown in an empty row in the table to indicate to the end user the the data is being loaded. Note that this parameter is not used when loading data by server-side processing, just Ajax sourced data with client-side processing.
$(document).ready( function() { $('#example').dataTable( { "oLanguage": { "sLoadingRecords": "Please wait - loading..." } } ); } );
Text which is displayed when the table is processing a user action (usually a sort command or similar).
$(document).ready( function() { $('#example').dataTable( { "oLanguage": { "sProcessing": "DataTables is currently busy" } } ); } );
Details the actions that will be taken when the user types into the filtering input text box. The variable "INPUT", if used in the string, is replaced with the HTML text box for the filtering input allowing control over where it appears in the string. If "INPUT" is not given then the input box is appended to the string automatically.
// Input text box will be appended at the end automatically $(document).ready( function() { $('#example').dataTable( { "oLanguage": { "sSearch": "Filter records:" } } ); } );
// Specify where the filter should appear $(document).ready( function() { $('#example').dataTable( { "oLanguage": { "sSearch": "Apply filter _INPUT_ to table" } } ); } );
All of the language information can be stored in a file on the server-side, which DataTables will look up if this parameter is passed. It must store the URL of the language file, which is in a JSON format, and the object has the same properties as the oLanguage object in the initialiser object (i.e. the above parameters). Please refer to one of the example language files to see how this works in action.
$(document).ready( function() { $('#example').dataTable( { "oLanguage": { "sUrl": "http://www.sprymedia.co.uk/dataTables/lang.txt" } } ); } );
Text shown inside the table records when the is no information to be displayed after filtering. sEmptyTable is shown when there is simply no information in the table at all (regardless of filtering).
$(document).ready( function() { $('#example').dataTable( { "oLanguage": { "sZeroRecords": "No records to display" } } ); } );