mirror of
https://github.com/DataTables/DataTables.git
synced 2024-12-01 13:24:10 +01:00
Dev: All the latest changes built into the main file
This commit is contained in:
parent
86fd198fdd
commit
748f8634cd
177
media/js/jquery.dataTables.js
vendored
177
media/js/jquery.dataTables.js
vendored
@ -510,7 +510,7 @@
|
||||
var aTargets = aoColDefs[i].targets || aoColDefs[i].aTargets;
|
||||
if ( ! $.isArray( aTargets ) )
|
||||
{
|
||||
_fnLog( oSettings, 1, 'aTargets must be an array of targets, not a '+(typeof aTargets) );
|
||||
aTargets = [ aTargets ];
|
||||
}
|
||||
|
||||
for ( j=0, jLen=aTargets.length ; j<jLen ; j++ )
|
||||
@ -718,8 +718,8 @@
|
||||
if ( oSettings.iDrawError != oSettings.iDraw && oCol.sDefaultContent === null )
|
||||
{
|
||||
_fnLog( oSettings, 0, "Requested unknown parameter "+
|
||||
(typeof oCol.mData=='function' ? '{mData function}' : "'"+oCol.mData+"'")+
|
||||
" from the data source for row "+iRow );
|
||||
(typeof oCol.mData=='function' ? '{function}' : "'"+oCol.mData+"'")+
|
||||
" for row "+iRow, 4 );
|
||||
oSettings.iDrawError = oSettings.iDraw;
|
||||
}
|
||||
return oCol.sDefaultContent;
|
||||
@ -1169,6 +1169,11 @@
|
||||
nTr.className += ' '+rowData.DT_RowClass;
|
||||
}
|
||||
|
||||
if ( rowData.DT_RowData )
|
||||
{
|
||||
$(nTr).data( rowData.DT_RowData );
|
||||
}
|
||||
|
||||
/* Process each column */
|
||||
for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
|
||||
{
|
||||
@ -1462,8 +1467,6 @@
|
||||
var iOpenRows = oSettings.aoOpenRows.length;
|
||||
var oLang = oSettings.oLanguage;
|
||||
var iInitDisplayStart = oSettings.iInitDisplayStart;
|
||||
var iDisplayStart = oSettings._iDisplayStart;
|
||||
var iDisplayEnd = oSettings.fnDisplayEnd();
|
||||
var bServerSide = oSettings.oFeatures.bServerSide;
|
||||
var aiDisplay = oSettings.aiDisplay;
|
||||
|
||||
@ -1472,7 +1475,7 @@
|
||||
/* Check and see if we have an initial draw position from state saving */
|
||||
if ( iInitDisplayStart !== undefined && iInitDisplayStart !== -1 )
|
||||
{
|
||||
iDisplayStart = bServerSide ?
|
||||
oSettings._iDisplayStart = bServerSide ?
|
||||
iInitDisplayStart :
|
||||
iInitDisplayStart >= oSettings.fnRecordsDisplay() ?
|
||||
0 :
|
||||
@ -1481,6 +1484,9 @@
|
||||
oSettings.iInitDisplayStart = -1;
|
||||
}
|
||||
|
||||
var iDisplayStart = oSettings._iDisplayStart;
|
||||
var iDisplayEnd = oSettings.fnDisplayEnd();
|
||||
|
||||
/* Server-side processing draw intercept */
|
||||
if ( oSettings.bDeferLoading )
|
||||
{
|
||||
@ -1948,7 +1954,7 @@
|
||||
"type": oSettings.sServerMethod,
|
||||
"error": function (xhr, error, thrown) {
|
||||
if ( error == "parsererror" ) {
|
||||
oSettings.oApi._fnLog( oSettings, 0, "DataTables: invalid JSON response" );
|
||||
oSettings.oApi._fnLog( oSettings, 0, 'Invalid JSON response', 1 );
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -2905,7 +2911,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
_fnLog( settings, 0, "Unknown paging action: "+action );
|
||||
_fnLog( settings, 0, "Unknown paging action: "+action, 5 );
|
||||
}
|
||||
|
||||
var changed = settings._iDisplayStart !== start;
|
||||
@ -3344,16 +3350,9 @@
|
||||
}
|
||||
|
||||
/* And give the user a warning that we've stopped the table getting too small */
|
||||
if ( o.oScroll.sX === "" )
|
||||
if ( o.oScroll.sX === "" || o.oScroll.sXInner !== "" )
|
||||
{
|
||||
_fnLog( o, 1, "The table cannot fit into the current element which will cause column"+
|
||||
" misalignment. The table has been drawn at its minimum possible width." );
|
||||
}
|
||||
else if ( o.oScroll.sXInner !== "" )
|
||||
{
|
||||
_fnLog( o, 1, "The table cannot fit into the current element which will cause column"+
|
||||
" misalignment. Increase the sScrollXInner value or remove it to allow automatic"+
|
||||
" calculation" );
|
||||
_fnLog( o, 1, 'Possible column misalignment', 6 );
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -4118,7 +4117,7 @@
|
||||
var nextSort;
|
||||
|
||||
// If the shift key is pressed then we are multiple column sorting
|
||||
if ( e.shiftKey ) {
|
||||
if ( e.shiftKey && settings.oFeatures.bSortMulti ) {
|
||||
// Are we already doing some kind of sort on this column?
|
||||
var curr = _pluck( sorting, '0' );
|
||||
var idx = $.inArray( colIdx, curr );
|
||||
@ -4368,6 +4367,11 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// Number of columns have changed - all bets are off, no restore of settings
|
||||
if ( oSettings.aoColumns.length !== oData.aoSearchCols.length ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Store the saved state so it might be accessed at any time */
|
||||
oSettings.oLoadedState = $.extend( true, {}, oData );
|
||||
|
||||
@ -4376,21 +4380,14 @@
|
||||
oSettings.iInitDisplayStart = oData.iStart;
|
||||
oSettings._iDisplayLength = oData.iLength;
|
||||
oSettings.aaSorting = oData.aaSorting.slice();
|
||||
oSettings.saved_aaSorting = oData.aaSorting.slice();
|
||||
|
||||
/* Search filtering */
|
||||
$.extend( oSettings.oPreviousSearch, oData.oSearch );
|
||||
$.extend( true, oSettings.aoPreSearchCols, oData.aoSearchCols );
|
||||
|
||||
/* Column visibility state
|
||||
* Pass back visibility settings to the init handler, but to do not here override
|
||||
* the init object that the user might have passed in
|
||||
*/
|
||||
oInit.saved_aoColumns = [];
|
||||
for ( var i=0 ; i<oData.abVisCols.length ; i++ )
|
||||
{
|
||||
oInit.saved_aoColumns[i] = {};
|
||||
oInit.saved_aoColumns[i].bVisible = oData.abVisCols[i];
|
||||
/* Column visibility state */
|
||||
for ( var i=0 ; i<oData.abVisCols.length ; i++ ) {
|
||||
oSettings.aoColumns[i].bVisible = oData.abVisCols[i];
|
||||
}
|
||||
|
||||
_fnCallbackFire( oSettings, 'aoStateLoaded', 'stateLoaded', [oSettings, oData] );
|
||||
@ -4400,52 +4397,49 @@
|
||||
|
||||
/**
|
||||
* Return the settings object for a particular table
|
||||
* @param {node} nTable table we are using as a dataTable
|
||||
* @param {node} table table we are using as a dataTable
|
||||
* @returns {object} Settings object - or null if not found
|
||||
* @memberof DataTable#oApi
|
||||
*/
|
||||
function _fnSettingsFromNode ( nTable )
|
||||
function _fnSettingsFromNode ( table )
|
||||
{
|
||||
for ( var i=0 ; i<DataTable.settings.length ; i++ )
|
||||
{
|
||||
if ( DataTable.settings[i].nTable === nTable )
|
||||
{
|
||||
return DataTable.settings[i];
|
||||
}
|
||||
}
|
||||
var settings = DataTable.settings;
|
||||
var idx = $.inArray( table, _pluck( settings, 'nTable' ) );
|
||||
|
||||
return null;
|
||||
return idx !== -1 ?
|
||||
settings[ idx ] :
|
||||
null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Log an error message
|
||||
* @param {object} oSettings dataTables settings object
|
||||
* @param {int} iLevel log error messages, or display them to the user
|
||||
* @param {string} sMesg error message
|
||||
* @param {object} settings dataTables settings object
|
||||
* @param {int} level log error messages, or display them to the user
|
||||
* @param {string} msg error message
|
||||
* @param {int} tn Technical note id to get more information about the error.
|
||||
* @memberof DataTable#oApi
|
||||
*/
|
||||
function _fnLog( oSettings, iLevel, sMesg )
|
||||
function _fnLog( settings, level, msg, tn )
|
||||
{
|
||||
var sAlert = (oSettings===null) ?
|
||||
"DataTables warning: "+sMesg :
|
||||
"DataTables warning (table id = '"+oSettings.sTableId+"'): "+sMesg;
|
||||
msg = 'DataTables warning: '+
|
||||
(settings!==null ? 'table id='+settings.sTableId+' - ' : '')+msg;
|
||||
|
||||
if ( iLevel === 0 )
|
||||
{
|
||||
if ( DataTable.ext.sErrMode == 'alert' )
|
||||
{
|
||||
alert( sAlert );
|
||||
if ( tn ) {
|
||||
msg += '. For more information about this error, please see '+
|
||||
'http://datatables.net/tn/'+tn;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Error(sAlert);
|
||||
|
||||
if ( ! level ) {
|
||||
if ( DataTable.ext.sErrMode == 'alert' ) {
|
||||
alert( msg );
|
||||
}
|
||||
return;
|
||||
else {
|
||||
throw new Error(msg);
|
||||
}
|
||||
else if ( window.console && console.log )
|
||||
{
|
||||
console.log( sAlert );
|
||||
}
|
||||
else if ( window.console && console.log ) {
|
||||
console.log( msg );
|
||||
}
|
||||
}
|
||||
|
||||
@ -5497,8 +5491,7 @@
|
||||
/* Sanity check */
|
||||
if ( this.nodeName.toLowerCase() != 'table' )
|
||||
{
|
||||
_fnLog( null, 0, "Attempted to initialise DataTables on a node which is not a "+
|
||||
"table: "+this.nodeName );
|
||||
_fnLog( null, 0, 'Non-table node initialisation ('+this.nodeName+')', 2 );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -5533,9 +5526,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
_fnLog( DataTable.settings[i], 0, "Cannot reinitialise DataTable.\n\n"+
|
||||
"To retrieve the DataTables object for this table, pass no arguments or see "+
|
||||
"the docs for bRetrieve and bDestroy" );
|
||||
_fnLog( DataTable.settings[i], 0, 'Cannot reinitialise DataTable', 3 );
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -5594,6 +5585,7 @@
|
||||
_fnMap( oSettings.oFeatures, oInit, "bLengthChange" );
|
||||
_fnMap( oSettings.oFeatures, oInit, "bFilter" );
|
||||
_fnMap( oSettings.oFeatures, oInit, "bSort" );
|
||||
_fnMap( oSettings.oFeatures, oInit, "bSortMulti" );
|
||||
_fnMap( oSettings.oFeatures, oInit, "bInfo" );
|
||||
_fnMap( oSettings.oFeatures, oInit, "bProcessing" );
|
||||
_fnMap( oSettings.oFeatures, oInit, "bAutoWidth" );
|
||||
@ -5689,14 +5681,6 @@
|
||||
oSettings._iDisplayStart = oInit.iDisplayStart;
|
||||
}
|
||||
|
||||
/* Must be done after everything which can be overridden by the state saving! */
|
||||
if ( oInit.bStateSave )
|
||||
{
|
||||
oSettings.oFeatures.bStateSave = true;
|
||||
_fnLoadState( oSettings, oInit );
|
||||
_fnCallbackReg( oSettings, 'aoDrawCallback', _fnSaveState, 'state_save' );
|
||||
}
|
||||
|
||||
if ( oInit.iDeferLoading !== null )
|
||||
{
|
||||
oSettings.bDeferLoading = true;
|
||||
@ -5782,16 +5766,6 @@
|
||||
/* Add the columns */
|
||||
for ( i=0, iLen=aoColumnsInit.length ; i<iLen ; i++ )
|
||||
{
|
||||
/* Short cut - use the loop to check if we have column visibility state to restore */
|
||||
if ( oInit.saved_aoColumns !== undefined && oInit.saved_aoColumns.length == iLen )
|
||||
{
|
||||
if ( aoColumnsInit[i] === null )
|
||||
{
|
||||
aoColumnsInit[i] = {};
|
||||
}
|
||||
aoColumnsInit[i].bVisible = oInit.saved_aoColumns[i].bVisible;
|
||||
}
|
||||
|
||||
_fnAddColumn( oSettings, anThs ? anThs[i] : null );
|
||||
}
|
||||
|
||||
@ -5801,6 +5775,15 @@
|
||||
} );
|
||||
|
||||
|
||||
/* Must be done after everything which can be overridden by the state saving! */
|
||||
if ( oInit.bStateSave )
|
||||
{
|
||||
oSettings.oFeatures.bStateSave = true;
|
||||
_fnLoadState( oSettings, oInit );
|
||||
_fnCallbackReg( oSettings, 'aoDrawCallback', _fnSaveState, 'state_save' );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Sorting
|
||||
* Check the aaSorting array
|
||||
@ -5820,7 +5803,7 @@
|
||||
}
|
||||
|
||||
/* If aaSorting is not defined, then we use the first indicator in asSorting */
|
||||
if ( oInit.aaSorting === undefined && oSettings.saved_aaSorting === undefined )
|
||||
if ( oInit.aaSorting === undefined )
|
||||
{
|
||||
oSettings.aaSorting[i][1] = oColumn.asSorting[0];
|
||||
}
|
||||
@ -8321,7 +8304,9 @@
|
||||
|
||||
// Restore the width of the original table - was read from the style property,
|
||||
// so we can restore directly to that
|
||||
jqTable.css( 'width', settings.sDestroyWidth );
|
||||
jqTable
|
||||
.css( 'width', settings.sDestroyWidth )
|
||||
.removeClass( classes.sTable );
|
||||
|
||||
// If the were originally stripe classes - then we add them back here.
|
||||
// Note this is not fool proof (for example if not all rows had stripe
|
||||
@ -9987,6 +9972,26 @@
|
||||
"bSort": true,
|
||||
|
||||
|
||||
/**
|
||||
* Enable or display DataTables' ability to sort multiple columns at the
|
||||
* same time (activated by shift-click by the user).
|
||||
* @type boolean
|
||||
* @default true
|
||||
*
|
||||
* @dtopt Options
|
||||
* @name DataTable.defaults.sortMulti
|
||||
*
|
||||
* @example
|
||||
* // Disable multiple column sorting ability
|
||||
* $(document).ready( function () {
|
||||
* $('#example').dataTable( {
|
||||
* "sortMulti": false
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"bSortMulti": true,
|
||||
|
||||
|
||||
/**
|
||||
* Allows control over whether DataTables should use the top (true) unique
|
||||
* cell that is found for a single column, or the bottom (false - default).
|
||||
@ -12417,6 +12422,14 @@
|
||||
*/
|
||||
"bSort": null,
|
||||
|
||||
/**
|
||||
* Multi-column sorting
|
||||
* Note that this parameter will be set by the initialisation routine. To
|
||||
* set a default use {@link DataTable.defaults}.
|
||||
* @type boolean
|
||||
*/
|
||||
"bSortMulti": null,
|
||||
|
||||
/**
|
||||
* Apply a class to the columns which are being sorted to provide a
|
||||
* visual highlight or not. This can slow things down when enabled since
|
||||
|
Loading…
Reference in New Issue
Block a user