1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-01-30 23:52:11 +01:00

New: New language option sLoadingRecords which is used when the table's data is Ajax sourced, and at the first draw only. This provides an

indication that the data is currently being sourced from the server (i.e. Loading...) rather than showing 'No data available in table' - which is
not particularly friendly. Note that for server-side processing, DataTables will leave whatever is in TBODY when it makes the first Ajax request,
so with server-side processing you would need to put in a TR/TD into the static HTML table.
This commit is contained in:
Allan Jardine 2011-05-13 10:19:29 +01:00
parent 9cf1ff785e
commit a84eec581b

View File

@ -969,6 +969,7 @@
"sLengthMenu": "Show _MENU_ entries",
"sZeroRecords": "No matching records found",
"sEmptyTable": "No data available in table",
"sLoadingRecords": "Loading...",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ entries",
"sInfoEmpty": "Showing 0 to 0 of 0 entries",
"sInfoFiltered": "(filtered from _MAX_ total entries)",
@ -2475,6 +2476,7 @@
_fnMap( oSettings.oLanguage, oLanguage, 'sProcessing' );
_fnMap( oSettings.oLanguage, oLanguage, 'sLengthMenu' );
_fnMap( oSettings.oLanguage, oLanguage, 'sEmptyTable' );
_fnMap( oSettings.oLanguage, oLanguage, 'sLoadingRecords' );
_fnMap( oSettings.oLanguage, oLanguage, 'sZeroRecords' );
_fnMap( oSettings.oLanguage, oLanguage, 'sInfo' );
_fnMap( oSettings.oLanguage, oLanguage, 'sInfoEmpty' );
@ -2498,6 +2500,13 @@
{
_fnMap( oSettings.oLanguage, oLanguage, 'sZeroRecords', 'sEmptyTable' );
}
/* Likewise with loading records */
if ( typeof oLanguage.sLoadingRecords == 'undefined' &&
typeof oLanguage.sZeroRecords != 'undefined' )
{
_fnMap( oSettings.oLanguage, oLanguage, 'sZeroRecords', 'sLoadingRecords' );
}
if ( bInit )
{
@ -3281,21 +3290,24 @@
{
anRows[ 0 ].className = oSettings.asStripClasses[0];
}
var sZero = oSettings.oLanguage.sZeroRecords.replace(
'_MAX_', oSettings.fnFormatNumber(oSettings.fnRecordsTotal()) );
if ( oSettings.iDraw == 1 && oSettings.sAjaxSource !== "" )
{
sZero = oSettings.oLanguage.sLoadingRecords;
}
else if ( typeof oSettings.oLanguage.sEmptyTable != 'undefined' &&
oSettings.fnRecordsTotal() === 0 )
{
sZero = oSettings.oLanguage.sEmptyTable;
}
var nTd = document.createElement( 'td' );
nTd.setAttribute( 'valign', "top" );
nTd.colSpan = _fnVisbleColumns( oSettings );
nTd.className = oSettings.oClasses.sRowEmpty;
if ( typeof oSettings.oLanguage.sEmptyTable != 'undefined' &&
oSettings.fnRecordsTotal() === 0 )
{
nTd.innerHTML = oSettings.oLanguage.sEmptyTable;
}
else
{
nTd.innerHTML = oSettings.oLanguage.sZeroRecords.replace(
'_MAX_', oSettings.fnFormatNumber(oSettings.fnRecordsTotal()) );
}
nTd.innerHTML = sZero;
anRows[ iRowCount ].appendChild( nTd );
}
@ -7287,3 +7299,4 @@
});
};
})(jQuery, window, document);