|
@@ -4,20 +4,20 @@
|
|
|
*
|
|
*
|
|
|
* To rebuild or modify this file with the latest versions of the included
|
|
* To rebuild or modify this file with the latest versions of the included
|
|
|
* software please visit:
|
|
* software please visit:
|
|
|
- * https://datatables.net/download/#bs5/dt-1.10.25
|
|
|
|
|
|
|
+ * https://datatables.net/download/#bs5/dt-1.11.2
|
|
|
*
|
|
*
|
|
|
* Included libraries:
|
|
* Included libraries:
|
|
|
- * DataTables 1.10.25
|
|
|
|
|
|
|
+ * DataTables 1.11.2
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
-/*! DataTables 1.10.25
|
|
|
|
|
|
|
+/*! DataTables 1.11.2
|
|
|
* ©2008-2021 SpryMedia Ltd - datatables.net/license
|
|
* ©2008-2021 SpryMedia Ltd - datatables.net/license
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @summary DataTables
|
|
* @summary DataTables
|
|
|
* @description Paginate, search and order HTML tables
|
|
* @description Paginate, search and order HTML tables
|
|
|
- * @version 1.10.25
|
|
|
|
|
|
|
+ * @version 1.11.2
|
|
|
* @file jquery.dataTables.js
|
|
* @file jquery.dataTables.js
|
|
|
* @author SpryMedia Ltd
|
|
* @author SpryMedia Ltd
|
|
|
* @contact www.datatables.net
|
|
* @contact www.datatables.net
|
|
@@ -65,7 +65,7 @@
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
// Browser
|
|
// Browser
|
|
|
- factory( jQuery, window, document );
|
|
|
|
|
|
|
+ window.DataTable = factory( jQuery, window, document );
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
(function( $, window, document, undefined ) {
|
|
(function( $, window, document, undefined ) {
|
|
@@ -103,8 +103,17 @@
|
|
|
* } );
|
|
* } );
|
|
|
* } );
|
|
* } );
|
|
|
*/
|
|
*/
|
|
|
- var DataTable = function ( options )
|
|
|
|
|
|
|
+ var DataTable = function ( selector, options )
|
|
|
{
|
|
{
|
|
|
|
|
+ // When creating with `new`, create a new DataTable, returning the API instance
|
|
|
|
|
+ if (this instanceof DataTable) {
|
|
|
|
|
+ return $(selector).DataTable(options);
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ // Argument switching
|
|
|
|
|
+ options = selector;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Perform a jQuery selector action on the table's TR elements (from the tbody) and
|
|
* Perform a jQuery selector action on the table's TR elements (from the tbody) and
|
|
|
* return the resulting jQuery object.
|
|
* return the resulting jQuery object.
|
|
@@ -1097,8 +1106,8 @@
|
|
|
dataType: 'json',
|
|
dataType: 'json',
|
|
|
url: oLanguage.sUrl,
|
|
url: oLanguage.sUrl,
|
|
|
success: function ( json ) {
|
|
success: function ( json ) {
|
|
|
- _fnLanguageCompat( json );
|
|
|
|
|
_fnCamelToHungarian( defaults.oLanguage, json );
|
|
_fnCamelToHungarian( defaults.oLanguage, json );
|
|
|
|
|
+ _fnLanguageCompat( json );
|
|
|
$.extend( true, oLanguage, json );
|
|
$.extend( true, oLanguage, json );
|
|
|
|
|
|
|
|
_fnCallbackFire( oSettings, null, 'i18n', [oSettings]);
|
|
_fnCallbackFire( oSettings, null, 'i18n', [oSettings]);
|
|
@@ -1313,10 +1322,11 @@
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/* Must be done after everything which can be overridden by the state saving! */
|
|
/* Must be done after everything which can be overridden by the state saving! */
|
|
|
|
|
+ _fnCallbackReg( oSettings, 'aoDrawCallback', _fnSaveState, 'state_save' );
|
|
|
|
|
+
|
|
|
if ( oInit.bStateSave )
|
|
if ( oInit.bStateSave )
|
|
|
{
|
|
{
|
|
|
features.bStateSave = true;
|
|
features.bStateSave = true;
|
|
|
- _fnCallbackReg( oSettings, 'aoDrawCallback', _fnSaveState, 'state_save' );
|
|
|
|
|
_fnLoadState( oSettings, oInit, loadedInit );
|
|
_fnLoadState( oSettings, oInit, loadedInit );
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
@@ -1687,6 +1697,227 @@
|
|
|
*/
|
|
*/
|
|
|
escapeRegex: function ( val ) {
|
|
escapeRegex: function ( val ) {
|
|
|
return val.replace( _re_escape_regex, '\\$1' );
|
|
return val.replace( _re_escape_regex, '\\$1' );
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Create a function that will write to a nested object or array
|
|
|
|
|
+ * @param {*} source JSON notation string
|
|
|
|
|
+ * @returns Write function
|
|
|
|
|
+ */
|
|
|
|
|
+ set: function ( source ) {
|
|
|
|
|
+ if ( $.isPlainObject( source ) ) {
|
|
|
|
|
+ /* Unlike get, only the underscore (global) option is used for for
|
|
|
|
|
+ * setting data since we don't know the type here. This is why an object
|
|
|
|
|
+ * option is not documented for `mData` (which is read/write), but it is
|
|
|
|
|
+ * for `mRender` which is read only.
|
|
|
|
|
+ */
|
|
|
|
|
+ return DataTable.util.set( source._ );
|
|
|
|
|
+ }
|
|
|
|
|
+ else if ( source === null ) {
|
|
|
|
|
+ // Nothing to do when the data source is null
|
|
|
|
|
+ return function () {};
|
|
|
|
|
+ }
|
|
|
|
|
+ else if ( typeof source === 'function' ) {
|
|
|
|
|
+ return function (data, val, meta) {
|
|
|
|
|
+ source( data, 'set', val, meta );
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+ else if ( typeof source === 'string' && (source.indexOf('.') !== -1 ||
|
|
|
|
|
+ source.indexOf('[') !== -1 || source.indexOf('(') !== -1) )
|
|
|
|
|
+ {
|
|
|
|
|
+ // Like the get, we need to get data from a nested object
|
|
|
|
|
+ var setData = function (data, val, src) {
|
|
|
|
|
+ var a = _fnSplitObjNotation( src ), b;
|
|
|
|
|
+ var aLast = a[a.length-1];
|
|
|
|
|
+ var arrayNotation, funcNotation, o, innerSrc;
|
|
|
|
|
+
|
|
|
|
|
+ for ( var i=0, iLen=a.length-1 ; i<iLen ; i++ ) {
|
|
|
|
|
+ // Protect against prototype pollution
|
|
|
|
|
+ if (a[i] === '__proto__' || a[i] === 'constructor') {
|
|
|
|
|
+ throw new Error('Cannot set prototype values');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // Check if we are dealing with an array notation request
|
|
|
|
|
+ arrayNotation = a[i].match(__reArray);
|
|
|
|
|
+ funcNotation = a[i].match(__reFn);
|
|
|
|
|
+
|
|
|
|
|
+ if ( arrayNotation ) {
|
|
|
|
|
+ a[i] = a[i].replace(__reArray, '');
|
|
|
|
|
+ data[ a[i] ] = [];
|
|
|
|
|
+
|
|
|
|
|
+ // Get the remainder of the nested object to set so we can recurse
|
|
|
|
|
+ b = a.slice();
|
|
|
|
|
+ b.splice( 0, i+1 );
|
|
|
|
|
+ innerSrc = b.join('.');
|
|
|
|
|
+
|
|
|
|
|
+ // Traverse each entry in the array setting the properties requested
|
|
|
|
|
+ if ( Array.isArray( val ) ) {
|
|
|
|
|
+ for ( var j=0, jLen=val.length ; j<jLen ; j++ ) {
|
|
|
|
|
+ o = {};
|
|
|
|
|
+ setData( o, val[j], innerSrc );
|
|
|
|
|
+ data[ a[i] ].push( o );
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ // We've been asked to save data to an array, but it
|
|
|
|
|
+ // isn't array data to be saved. Best that can be done
|
|
|
|
|
+ // is to just save the value.
|
|
|
|
|
+ data[ a[i] ] = val;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // The inner call to setData has already traversed through the remainder
|
|
|
|
|
+ // of the source and has set the data, thus we can exit here
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ else if ( funcNotation ) {
|
|
|
|
|
+ // Function call
|
|
|
|
|
+ a[i] = a[i].replace(__reFn, '');
|
|
|
|
|
+ data = data[ a[i] ]( val );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // If the nested object doesn't currently exist - since we are
|
|
|
|
|
+ // trying to set the value - create it
|
|
|
|
|
+ if ( data[ a[i] ] === null || data[ a[i] ] === undefined ) {
|
|
|
|
|
+ data[ a[i] ] = {};
|
|
|
|
|
+ }
|
|
|
|
|
+ data = data[ a[i] ];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // Last item in the input - i.e, the actual set
|
|
|
|
|
+ if ( aLast.match(__reFn ) ) {
|
|
|
|
|
+ // Function call
|
|
|
|
|
+ data = data[ aLast.replace(__reFn, '') ]( val );
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ // If array notation is used, we just want to strip it and use the property name
|
|
|
|
|
+ // and assign the value. If it isn't used, then we get the result we want anyway
|
|
|
|
|
+ data[ aLast.replace(__reArray, '') ] = val;
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ return function (data, val) { // meta is also passed in, but not used
|
|
|
|
|
+ return setData( data, val, source );
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ // Array or flat object mapping
|
|
|
|
|
+ return function (data, val) { // meta is also passed in, but not used
|
|
|
|
|
+ data[source] = val;
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Create a function that will read nested objects from arrays, based on JSON notation
|
|
|
|
|
+ * @param {*} source JSON notation string
|
|
|
|
|
+ * @returns Value read
|
|
|
|
|
+ */
|
|
|
|
|
+ get: function ( source ) {
|
|
|
|
|
+ if ( $.isPlainObject( source ) ) {
|
|
|
|
|
+ // Build an object of get functions, and wrap them in a single call
|
|
|
|
|
+ var o = {};
|
|
|
|
|
+ $.each( source, function (key, val) {
|
|
|
|
|
+ if ( val ) {
|
|
|
|
|
+ o[key] = DataTable.util.get( val );
|
|
|
|
|
+ }
|
|
|
|
|
+ } );
|
|
|
|
|
+
|
|
|
|
|
+ return function (data, type, row, meta) {
|
|
|
|
|
+ var t = o[type] || o._;
|
|
|
|
|
+ return t !== undefined ?
|
|
|
|
|
+ t(data, type, row, meta) :
|
|
|
|
|
+ data;
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+ else if ( source === null ) {
|
|
|
|
|
+ // Give an empty string for rendering / sorting etc
|
|
|
|
|
+ return function (data) { // type, row and meta also passed, but not used
|
|
|
|
|
+ return data;
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+ else if ( typeof source === 'function' ) {
|
|
|
|
|
+ return function (data, type, row, meta) {
|
|
|
|
|
+ return source( data, type, row, meta );
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+ else if ( typeof source === 'string' && (source.indexOf('.') !== -1 ||
|
|
|
|
|
+ source.indexOf('[') !== -1 || source.indexOf('(') !== -1) )
|
|
|
|
|
+ {
|
|
|
|
|
+ /* If there is a . in the source string then the data source is in a
|
|
|
|
|
+ * nested object so we loop over the data for each level to get the next
|
|
|
|
|
+ * level down. On each loop we test for undefined, and if found immediately
|
|
|
|
|
+ * return. This allows entire objects to be missing and sDefaultContent to
|
|
|
|
|
+ * be used if defined, rather than throwing an error
|
|
|
|
|
+ */
|
|
|
|
|
+ var fetchData = function (data, type, src) {
|
|
|
|
|
+ var arrayNotation, funcNotation, out, innerSrc;
|
|
|
|
|
+
|
|
|
|
|
+ if ( src !== "" ) {
|
|
|
|
|
+ var a = _fnSplitObjNotation( src );
|
|
|
|
|
+
|
|
|
|
|
+ for ( var i=0, iLen=a.length ; i<iLen ; i++ ) {
|
|
|
|
|
+ // Check if we are dealing with special notation
|
|
|
|
|
+ arrayNotation = a[i].match(__reArray);
|
|
|
|
|
+ funcNotation = a[i].match(__reFn);
|
|
|
|
|
+
|
|
|
|
|
+ if ( arrayNotation ) {
|
|
|
|
|
+ // Array notation
|
|
|
|
|
+ a[i] = a[i].replace(__reArray, '');
|
|
|
|
|
+
|
|
|
|
|
+ // Condition allows simply [] to be passed in
|
|
|
|
|
+ if ( a[i] !== "" ) {
|
|
|
|
|
+ data = data[ a[i] ];
|
|
|
|
|
+ }
|
|
|
|
|
+ out = [];
|
|
|
|
|
+
|
|
|
|
|
+ // Get the remainder of the nested object to get
|
|
|
|
|
+ a.splice( 0, i+1 );
|
|
|
|
|
+ innerSrc = a.join('.');
|
|
|
|
|
+
|
|
|
|
|
+ // Traverse each entry in the array getting the properties requested
|
|
|
|
|
+ if ( Array.isArray( data ) ) {
|
|
|
|
|
+ for ( var j=0, jLen=data.length ; j<jLen ; j++ ) {
|
|
|
|
|
+ out.push( fetchData( data[j], type, innerSrc ) );
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // If a string is given in between the array notation indicators, that
|
|
|
|
|
+ // is used to join the strings together, otherwise an array is returned
|
|
|
|
|
+ var join = arrayNotation[0].substring(1, arrayNotation[0].length-1);
|
|
|
|
|
+ data = (join==="") ? out : out.join(join);
|
|
|
|
|
+
|
|
|
|
|
+ // The inner call to fetchData has already traversed through the remainder
|
|
|
|
|
+ // of the source requested, so we exit from the loop
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ else if ( funcNotation ) {
|
|
|
|
|
+ // Function call
|
|
|
|
|
+ a[i] = a[i].replace(__reFn, '');
|
|
|
|
|
+ data = data[ a[i] ]();
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ( data === null || data[ a[i] ] === undefined ) {
|
|
|
|
|
+ return undefined;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ data = data[ a[i] ];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return data;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ return function (data, type) { // row and meta also passed, but not used
|
|
|
|
|
+ return fetchData( data, type, source );
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ // Array or flat object mapping
|
|
|
|
|
+ return function (data, type) { // row and meta also passed, but not used
|
|
|
|
|
+ return data[source];
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -2201,7 +2432,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Covert the index of a visible column to the index in the data array (take account
|
|
|
|
|
|
|
+ * Convert the index of a visible column to the index in the data array (take account
|
|
|
* of hidden columns)
|
|
* of hidden columns)
|
|
|
* @param {object} oSettings dataTables settings object
|
|
* @param {object} oSettings dataTables settings object
|
|
|
* @param {int} iMatch Visible column index to lookup
|
|
* @param {int} iMatch Visible column index to lookup
|
|
@@ -2219,7 +2450,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Covert the index of an index in the data array and convert it to the visible
|
|
|
|
|
|
|
+ * Convert the index of an index in the data array and convert it to the visible
|
|
|
* column index (take account of hidden columns)
|
|
* column index (take account of hidden columns)
|
|
|
* @param {int} iMatch Column index to lookup
|
|
* @param {int} iMatch Column index to lookup
|
|
|
* @param {object} oSettings dataTables settings object
|
|
* @param {object} oSettings dataTables settings object
|
|
@@ -2533,12 +2764,19 @@
|
|
|
* @param {object} settings dataTables settings object
|
|
* @param {object} settings dataTables settings object
|
|
|
* @param {int} rowIdx aoData row id
|
|
* @param {int} rowIdx aoData row id
|
|
|
* @param {int} colIdx Column index
|
|
* @param {int} colIdx Column index
|
|
|
- * @param {string} type data get type ('display', 'type' 'filter' 'sort')
|
|
|
|
|
|
|
+ * @param {string} type data get type ('display', 'type' 'filter|search' 'sort|order')
|
|
|
* @returns {*} Cell data
|
|
* @returns {*} Cell data
|
|
|
* @memberof DataTable#oApi
|
|
* @memberof DataTable#oApi
|
|
|
*/
|
|
*/
|
|
|
function _fnGetCellData( settings, rowIdx, colIdx, type )
|
|
function _fnGetCellData( settings, rowIdx, colIdx, type )
|
|
|
{
|
|
{
|
|
|
|
|
+ if (type === 'search') {
|
|
|
|
|
+ type = 'filter';
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (type === 'order') {
|
|
|
|
|
+ type = 'sort';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
var draw = settings.iDraw;
|
|
var draw = settings.iDraw;
|
|
|
var col = settings.aoColumns[colIdx];
|
|
var col = settings.aoColumns[colIdx];
|
|
|
var rowData = settings.aoData[rowIdx]._aData;
|
|
var rowData = settings.aoData[rowIdx]._aData;
|
|
@@ -2622,122 +2860,7 @@
|
|
|
* @returns {function} Data get function
|
|
* @returns {function} Data get function
|
|
|
* @memberof DataTable#oApi
|
|
* @memberof DataTable#oApi
|
|
|
*/
|
|
*/
|
|
|
- function _fnGetObjectDataFn( mSource )
|
|
|
|
|
- {
|
|
|
|
|
- if ( $.isPlainObject( mSource ) )
|
|
|
|
|
- {
|
|
|
|
|
- /* Build an object of get functions, and wrap them in a single call */
|
|
|
|
|
- var o = {};
|
|
|
|
|
- $.each( mSource, function (key, val) {
|
|
|
|
|
- if ( val ) {
|
|
|
|
|
- o[key] = _fnGetObjectDataFn( val );
|
|
|
|
|
- }
|
|
|
|
|
- } );
|
|
|
|
|
-
|
|
|
|
|
- return function (data, type, row, meta) {
|
|
|
|
|
- var t = o[type] || o._;
|
|
|
|
|
- return t !== undefined ?
|
|
|
|
|
- t(data, type, row, meta) :
|
|
|
|
|
- data;
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- else if ( mSource === null )
|
|
|
|
|
- {
|
|
|
|
|
- /* Give an empty string for rendering / sorting etc */
|
|
|
|
|
- return function (data) { // type, row and meta also passed, but not used
|
|
|
|
|
- return data;
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- else if ( typeof mSource === 'function' )
|
|
|
|
|
- {
|
|
|
|
|
- return function (data, type, row, meta) {
|
|
|
|
|
- return mSource( data, type, row, meta );
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- else if ( typeof mSource === 'string' && (mSource.indexOf('.') !== -1 ||
|
|
|
|
|
- mSource.indexOf('[') !== -1 || mSource.indexOf('(') !== -1) )
|
|
|
|
|
- {
|
|
|
|
|
- /* If there is a . in the source string then the data source is in a
|
|
|
|
|
- * nested object so we loop over the data for each level to get the next
|
|
|
|
|
- * level down. On each loop we test for undefined, and if found immediately
|
|
|
|
|
- * return. This allows entire objects to be missing and sDefaultContent to
|
|
|
|
|
- * be used if defined, rather than throwing an error
|
|
|
|
|
- */
|
|
|
|
|
- var fetchData = function (data, type, src) {
|
|
|
|
|
- var arrayNotation, funcNotation, out, innerSrc;
|
|
|
|
|
-
|
|
|
|
|
- if ( src !== "" )
|
|
|
|
|
- {
|
|
|
|
|
- var a = _fnSplitObjNotation( src );
|
|
|
|
|
-
|
|
|
|
|
- for ( var i=0, iLen=a.length ; i<iLen ; i++ )
|
|
|
|
|
- {
|
|
|
|
|
- // Check if we are dealing with special notation
|
|
|
|
|
- arrayNotation = a[i].match(__reArray);
|
|
|
|
|
- funcNotation = a[i].match(__reFn);
|
|
|
|
|
-
|
|
|
|
|
- if ( arrayNotation )
|
|
|
|
|
- {
|
|
|
|
|
- // Array notation
|
|
|
|
|
- a[i] = a[i].replace(__reArray, '');
|
|
|
|
|
-
|
|
|
|
|
- // Condition allows simply [] to be passed in
|
|
|
|
|
- if ( a[i] !== "" ) {
|
|
|
|
|
- data = data[ a[i] ];
|
|
|
|
|
- }
|
|
|
|
|
- out = [];
|
|
|
|
|
-
|
|
|
|
|
- // Get the remainder of the nested object to get
|
|
|
|
|
- a.splice( 0, i+1 );
|
|
|
|
|
- innerSrc = a.join('.');
|
|
|
|
|
-
|
|
|
|
|
- // Traverse each entry in the array getting the properties requested
|
|
|
|
|
- if ( Array.isArray( data ) ) {
|
|
|
|
|
- for ( var j=0, jLen=data.length ; j<jLen ; j++ ) {
|
|
|
|
|
- out.push( fetchData( data[j], type, innerSrc ) );
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // If a string is given in between the array notation indicators, that
|
|
|
|
|
- // is used to join the strings together, otherwise an array is returned
|
|
|
|
|
- var join = arrayNotation[0].substring(1, arrayNotation[0].length-1);
|
|
|
|
|
- data = (join==="") ? out : out.join(join);
|
|
|
|
|
-
|
|
|
|
|
- // The inner call to fetchData has already traversed through the remainder
|
|
|
|
|
- // of the source requested, so we exit from the loop
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- else if ( funcNotation )
|
|
|
|
|
- {
|
|
|
|
|
- // Function call
|
|
|
|
|
- a[i] = a[i].replace(__reFn, '');
|
|
|
|
|
- data = data[ a[i] ]();
|
|
|
|
|
- continue;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if ( data === null || data[ a[i] ] === undefined )
|
|
|
|
|
- {
|
|
|
|
|
- return undefined;
|
|
|
|
|
- }
|
|
|
|
|
- data = data[ a[i] ];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return data;
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- return function (data, type) { // row and meta also passed, but not used
|
|
|
|
|
- return fetchData( data, type, mSource );
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- /* Array or flat object mapping */
|
|
|
|
|
- return function (data, type) { // row and meta also passed, but not used
|
|
|
|
|
- return data[mSource];
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ var _fnGetObjectDataFn = DataTable.util.get;
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -2747,122 +2870,7 @@
|
|
|
* @returns {function} Data set function
|
|
* @returns {function} Data set function
|
|
|
* @memberof DataTable#oApi
|
|
* @memberof DataTable#oApi
|
|
|
*/
|
|
*/
|
|
|
- function _fnSetObjectDataFn( mSource )
|
|
|
|
|
- {
|
|
|
|
|
- if ( $.isPlainObject( mSource ) )
|
|
|
|
|
- {
|
|
|
|
|
- /* Unlike get, only the underscore (global) option is used for for
|
|
|
|
|
- * setting data since we don't know the type here. This is why an object
|
|
|
|
|
- * option is not documented for `mData` (which is read/write), but it is
|
|
|
|
|
- * for `mRender` which is read only.
|
|
|
|
|
- */
|
|
|
|
|
- return _fnSetObjectDataFn( mSource._ );
|
|
|
|
|
- }
|
|
|
|
|
- else if ( mSource === null )
|
|
|
|
|
- {
|
|
|
|
|
- /* Nothing to do when the data source is null */
|
|
|
|
|
- return function () {};
|
|
|
|
|
- }
|
|
|
|
|
- else if ( typeof mSource === 'function' )
|
|
|
|
|
- {
|
|
|
|
|
- return function (data, val, meta) {
|
|
|
|
|
- mSource( data, 'set', val, meta );
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- else if ( typeof mSource === 'string' && (mSource.indexOf('.') !== -1 ||
|
|
|
|
|
- mSource.indexOf('[') !== -1 || mSource.indexOf('(') !== -1) )
|
|
|
|
|
- {
|
|
|
|
|
- /* Like the get, we need to get data from a nested object */
|
|
|
|
|
- var setData = function (data, val, src) {
|
|
|
|
|
- var a = _fnSplitObjNotation( src ), b;
|
|
|
|
|
- var aLast = a[a.length-1];
|
|
|
|
|
- var arrayNotation, funcNotation, o, innerSrc;
|
|
|
|
|
-
|
|
|
|
|
- for ( var i=0, iLen=a.length-1 ; i<iLen ; i++ )
|
|
|
|
|
- {
|
|
|
|
|
- // Protect against prototype pollution
|
|
|
|
|
- if (a[i] === '__proto__' || a[i] === 'constructor') {
|
|
|
|
|
- throw new Error('Cannot set prototype values');
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // Check if we are dealing with an array notation request
|
|
|
|
|
- arrayNotation = a[i].match(__reArray);
|
|
|
|
|
- funcNotation = a[i].match(__reFn);
|
|
|
|
|
-
|
|
|
|
|
- if ( arrayNotation )
|
|
|
|
|
- {
|
|
|
|
|
- a[i] = a[i].replace(__reArray, '');
|
|
|
|
|
- data[ a[i] ] = [];
|
|
|
|
|
-
|
|
|
|
|
- // Get the remainder of the nested object to set so we can recurse
|
|
|
|
|
- b = a.slice();
|
|
|
|
|
- b.splice( 0, i+1 );
|
|
|
|
|
- innerSrc = b.join('.');
|
|
|
|
|
-
|
|
|
|
|
- // Traverse each entry in the array setting the properties requested
|
|
|
|
|
- if ( Array.isArray( val ) )
|
|
|
|
|
- {
|
|
|
|
|
- for ( var j=0, jLen=val.length ; j<jLen ; j++ )
|
|
|
|
|
- {
|
|
|
|
|
- o = {};
|
|
|
|
|
- setData( o, val[j], innerSrc );
|
|
|
|
|
- data[ a[i] ].push( o );
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- // We've been asked to save data to an array, but it
|
|
|
|
|
- // isn't array data to be saved. Best that can be done
|
|
|
|
|
- // is to just save the value.
|
|
|
|
|
- data[ a[i] ] = val;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // The inner call to setData has already traversed through the remainder
|
|
|
|
|
- // of the source and has set the data, thus we can exit here
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- else if ( funcNotation )
|
|
|
|
|
- {
|
|
|
|
|
- // Function call
|
|
|
|
|
- a[i] = a[i].replace(__reFn, '');
|
|
|
|
|
- data = data[ a[i] ]( val );
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // If the nested object doesn't currently exist - since we are
|
|
|
|
|
- // trying to set the value - create it
|
|
|
|
|
- if ( data[ a[i] ] === null || data[ a[i] ] === undefined )
|
|
|
|
|
- {
|
|
|
|
|
- data[ a[i] ] = {};
|
|
|
|
|
- }
|
|
|
|
|
- data = data[ a[i] ];
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // Last item in the input - i.e, the actual set
|
|
|
|
|
- if ( aLast.match(__reFn ) )
|
|
|
|
|
- {
|
|
|
|
|
- // Function call
|
|
|
|
|
- data = data[ aLast.replace(__reFn, '') ]( val );
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- // If array notation is used, we just want to strip it and use the property name
|
|
|
|
|
- // and assign the value. If it isn't used, then we get the result we want anyway
|
|
|
|
|
- data[ aLast.replace(__reArray, '') ] = val;
|
|
|
|
|
- }
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- return function (data, val) { // meta is also passed in, but not used
|
|
|
|
|
- return setData( data, val, mSource );
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- /* Array or flat object mapping */
|
|
|
|
|
- return function (data, val) { // meta is also passed in, but not used
|
|
|
|
|
- data[mSource] = val;
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ var _fnSetObjectDataFn = DataTable.util.set;
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -3291,9 +3299,6 @@
|
|
|
if ( createHeader ) {
|
|
if ( createHeader ) {
|
|
|
_fnDetectHeader( oSettings.aoHeader, thead );
|
|
_fnDetectHeader( oSettings.aoHeader, thead );
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- /* ARIA role for the rows */
|
|
|
|
|
- $(thead).children('tr').attr('role', 'row');
|
|
|
|
|
|
|
|
|
|
/* Deal with the footer - add classes if required */
|
|
/* Deal with the footer - add classes if required */
|
|
|
$(thead).children('tr').children('th, td').addClass( classes.sHeaderTH );
|
|
$(thead).children('tr').children('th, td').addClass( classes.sHeaderTH );
|
|
@@ -3912,6 +3917,22 @@
|
|
|
var ajax = oSettings.ajax;
|
|
var ajax = oSettings.ajax;
|
|
|
var instance = oSettings.oInstance;
|
|
var instance = oSettings.oInstance;
|
|
|
var callback = function ( json ) {
|
|
var callback = function ( json ) {
|
|
|
|
|
+ var status = oSettings.jqXhr
|
|
|
|
|
+ ? oSettings.jqXhr.status
|
|
|
|
|
+ : null;
|
|
|
|
|
+
|
|
|
|
|
+ if ( json === null || (typeof status === 'number' && status == 204 ) ) {
|
|
|
|
|
+ json = {};
|
|
|
|
|
+ _fnAjaxDataSrc( oSettings, json, [] );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ var error = json.error || json.sError;
|
|
|
|
|
+ if ( error ) {
|
|
|
|
|
+ _fnLog( oSettings, 0, error );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ oSettings.json = json;
|
|
|
|
|
+
|
|
|
_fnCallbackFire( oSettings, null, 'xhr', [oSettings, json, oSettings.jqXHR] );
|
|
_fnCallbackFire( oSettings, null, 'xhr', [oSettings, json, oSettings.jqXHR] );
|
|
|
fn( json );
|
|
fn( json );
|
|
|
};
|
|
};
|
|
@@ -3936,15 +3957,7 @@
|
|
|
|
|
|
|
|
var baseAjax = {
|
|
var baseAjax = {
|
|
|
"data": data,
|
|
"data": data,
|
|
|
- "success": function (json) {
|
|
|
|
|
- var error = json.error || json.sError;
|
|
|
|
|
- if ( error ) {
|
|
|
|
|
- _fnLog( oSettings, 0, error );
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- oSettings.json = json;
|
|
|
|
|
- callback( json );
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ "success": callback,
|
|
|
"dataType": "json",
|
|
"dataType": "json",
|
|
|
"cache": false,
|
|
"cache": false,
|
|
|
"type": oSettings.sServerMethod,
|
|
"type": oSettings.sServerMethod,
|
|
@@ -4166,6 +4179,11 @@
|
|
|
settings.iDraw = draw * 1;
|
|
settings.iDraw = draw * 1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // No data in returned object, so rather than an array, we show an empty table
|
|
|
|
|
+ if ( ! data ) {
|
|
|
|
|
+ data = [];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
_fnClearTable( settings );
|
|
_fnClearTable( settings );
|
|
|
settings._iRecordsTotal = parseInt(recordsTotal, 10);
|
|
settings._iRecordsTotal = parseInt(recordsTotal, 10);
|
|
|
settings._iRecordsDisplay = parseInt(recordsFiltered, 10);
|
|
settings._iRecordsDisplay = parseInt(recordsFiltered, 10);
|
|
@@ -4193,21 +4211,26 @@
|
|
|
* @param {object} json Data source object / array from the server
|
|
* @param {object} json Data source object / array from the server
|
|
|
* @return {array} Array of data to use
|
|
* @return {array} Array of data to use
|
|
|
*/
|
|
*/
|
|
|
- function _fnAjaxDataSrc ( oSettings, json )
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ function _fnAjaxDataSrc ( oSettings, json, write )
|
|
|
|
|
+ {
|
|
|
var dataSrc = $.isPlainObject( oSettings.ajax ) && oSettings.ajax.dataSrc !== undefined ?
|
|
var dataSrc = $.isPlainObject( oSettings.ajax ) && oSettings.ajax.dataSrc !== undefined ?
|
|
|
oSettings.ajax.dataSrc :
|
|
oSettings.ajax.dataSrc :
|
|
|
oSettings.sAjaxDataProp; // Compatibility with 1.9-.
|
|
oSettings.sAjaxDataProp; // Compatibility with 1.9-.
|
|
|
|
|
|
|
|
- // Compatibility with 1.9-. In order to read from aaData, check if the
|
|
|
|
|
- // default has been changed, if not, check for aaData
|
|
|
|
|
- if ( dataSrc === 'data' ) {
|
|
|
|
|
- return json.aaData || json[dataSrc];
|
|
|
|
|
|
|
+ if ( ! write ) {
|
|
|
|
|
+ if ( dataSrc === 'data' ) {
|
|
|
|
|
+ // If the default, then we still want to support the old style, and safely ignore
|
|
|
|
|
+ // it if possible
|
|
|
|
|
+ return json.aaData || json[dataSrc];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return dataSrc !== "" ?
|
|
|
|
|
+ _fnGetObjectDataFn( dataSrc )( json ) :
|
|
|
|
|
+ json;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return dataSrc !== "" ?
|
|
|
|
|
- _fnGetObjectDataFn( dataSrc )( json ) :
|
|
|
|
|
- json;
|
|
|
|
|
|
|
+ // set
|
|
|
|
|
+ _fnSetObjectDataFn( dataSrc )( json, write );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -4236,18 +4259,21 @@
|
|
|
} )
|
|
} )
|
|
|
.append( $('<label/>' ).append( str ) );
|
|
.append( $('<label/>' ).append( str ) );
|
|
|
|
|
|
|
|
- var searchFn = function() {
|
|
|
|
|
|
|
+ var searchFn = function(event) {
|
|
|
/* Update all other filter input elements for the new display */
|
|
/* Update all other filter input elements for the new display */
|
|
|
var n = features.f;
|
|
var n = features.f;
|
|
|
var val = !this.value ? "" : this.value; // mental IE8 fix :-(
|
|
var val = !this.value ? "" : this.value; // mental IE8 fix :-(
|
|
|
-
|
|
|
|
|
|
|
+ if(previousSearch.return && event.key !== "Enter") {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
/* Now do the filter */
|
|
/* Now do the filter */
|
|
|
if ( val != previousSearch.sSearch ) {
|
|
if ( val != previousSearch.sSearch ) {
|
|
|
_fnFilterComplete( settings, {
|
|
_fnFilterComplete( settings, {
|
|
|
"sSearch": val,
|
|
"sSearch": val,
|
|
|
"bRegex": previousSearch.bRegex,
|
|
"bRegex": previousSearch.bRegex,
|
|
|
"bSmart": previousSearch.bSmart ,
|
|
"bSmart": previousSearch.bSmart ,
|
|
|
- "bCaseInsensitive": previousSearch.bCaseInsensitive
|
|
|
|
|
|
|
+ "bCaseInsensitive": previousSearch.bCaseInsensitive,
|
|
|
|
|
+ "return": previousSearch.return
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
// Need to redraw, without resorting
|
|
// Need to redraw, without resorting
|
|
@@ -4276,7 +4302,7 @@
|
|
|
// on the clear icon (Edge bug 17584515). This is safe in other browsers as `searchFn`
|
|
// on the clear icon (Edge bug 17584515). This is safe in other browsers as `searchFn`
|
|
|
// checks the value to see if it has changed. In other browsers it won't have.
|
|
// checks the value to see if it has changed. In other browsers it won't have.
|
|
|
setTimeout( function () {
|
|
setTimeout( function () {
|
|
|
- searchFn.call(jqFilter[0]);
|
|
|
|
|
|
|
+ searchFn.call(jqFilter[0], e);
|
|
|
}, 10);
|
|
}, 10);
|
|
|
} )
|
|
} )
|
|
|
.on( 'keypress.DT', function(e) {
|
|
.on( 'keypress.DT', function(e) {
|
|
@@ -4322,6 +4348,7 @@
|
|
|
oPrevSearch.bRegex = oFilter.bRegex;
|
|
oPrevSearch.bRegex = oFilter.bRegex;
|
|
|
oPrevSearch.bSmart = oFilter.bSmart;
|
|
oPrevSearch.bSmart = oFilter.bSmart;
|
|
|
oPrevSearch.bCaseInsensitive = oFilter.bCaseInsensitive;
|
|
oPrevSearch.bCaseInsensitive = oFilter.bCaseInsensitive;
|
|
|
|
|
+ oPrevSearch.return = oFilter.return;
|
|
|
};
|
|
};
|
|
|
var fnRegex = function ( o ) {
|
|
var fnRegex = function ( o ) {
|
|
|
// Backwards compatibility with the bEscapeRegex option
|
|
// Backwards compatibility with the bEscapeRegex option
|
|
@@ -4336,7 +4363,7 @@
|
|
|
if ( _fnDataSource( oSettings ) != 'ssp' )
|
|
if ( _fnDataSource( oSettings ) != 'ssp' )
|
|
|
{
|
|
{
|
|
|
/* Global filter */
|
|
/* Global filter */
|
|
|
- _fnFilter( oSettings, oInput.sSearch, iForce, fnRegex(oInput), oInput.bSmart, oInput.bCaseInsensitive );
|
|
|
|
|
|
|
+ _fnFilter( oSettings, oInput.sSearch, iForce, fnRegex(oInput), oInput.bSmart, oInput.bCaseInsensitive, oInput.return );
|
|
|
fnSaveFilter( oInput );
|
|
fnSaveFilter( oInput );
|
|
|
|
|
|
|
|
/* Now do the individual column filter */
|
|
/* Now do the individual column filter */
|
|
@@ -4399,7 +4426,7 @@
|
|
|
* @param {int} iColumn column to filter
|
|
* @param {int} iColumn column to filter
|
|
|
* @param {bool} bRegex treat search string as a regular expression or not
|
|
* @param {bool} bRegex treat search string as a regular expression or not
|
|
|
* @param {bool} bSmart use smart filtering or not
|
|
* @param {bool} bSmart use smart filtering or not
|
|
|
- * @param {bool} bCaseInsensitive Do case insenstive matching or not
|
|
|
|
|
|
|
+ * @param {bool} bCaseInsensitive Do case insensitive matching or not
|
|
|
* @memberof DataTable#oApi
|
|
* @memberof DataTable#oApi
|
|
|
*/
|
|
*/
|
|
|
function _fnFilterColumn ( settings, searchStr, colIdx, regex, smart, caseInsensitive )
|
|
function _fnFilterColumn ( settings, searchStr, colIdx, regex, smart, caseInsensitive )
|
|
@@ -4432,7 +4459,7 @@
|
|
|
* @param {int} force optional - force a research of the master array (1) or not (undefined or 0)
|
|
* @param {int} force optional - force a research of the master array (1) or not (undefined or 0)
|
|
|
* @param {bool} regex treat as a regular expression or not
|
|
* @param {bool} regex treat as a regular expression or not
|
|
|
* @param {bool} smart perform smart filtering or not
|
|
* @param {bool} smart perform smart filtering or not
|
|
|
- * @param {bool} caseInsensitive Do case insenstive matching or not
|
|
|
|
|
|
|
+ * @param {bool} caseInsensitive Do case insensitive matching or not
|
|
|
* @memberof DataTable#oApi
|
|
* @memberof DataTable#oApi
|
|
|
*/
|
|
*/
|
|
|
function _fnFilter( settings, input, force, regex, smart, caseInsensitive )
|
|
function _fnFilter( settings, input, force, regex, smart, caseInsensitive )
|
|
@@ -5093,9 +5120,6 @@
|
|
|
{
|
|
{
|
|
|
var table = $(settings.nTable);
|
|
var table = $(settings.nTable);
|
|
|
|
|
|
|
|
- // Add the ARIA grid role to the table
|
|
|
|
|
- table.attr( 'role', 'grid' );
|
|
|
|
|
-
|
|
|
|
|
// Scrolling from here on in
|
|
// Scrolling from here on in
|
|
|
var scroll = settings.oScroll;
|
|
var scroll = settings.oScroll;
|
|
|
|
|
|
|
@@ -5383,17 +5407,17 @@
|
|
|
|
|
|
|
|
// Read all widths in next pass
|
|
// Read all widths in next pass
|
|
|
_fnApplyToChildren( function(nSizer) {
|
|
_fnApplyToChildren( function(nSizer) {
|
|
|
|
|
+ var style = window.getComputedStyle ?
|
|
|
|
|
+ window.getComputedStyle(nSizer).width :
|
|
|
|
|
+ _fnStringToCss( $(nSizer).width() );
|
|
|
|
|
+
|
|
|
headerContent.push( nSizer.innerHTML );
|
|
headerContent.push( nSizer.innerHTML );
|
|
|
- headerWidths.push( _fnStringToCss( $(nSizer).css('width') ) );
|
|
|
|
|
|
|
+ headerWidths.push( style );
|
|
|
}, headerSrcEls );
|
|
}, headerSrcEls );
|
|
|
|
|
|
|
|
// Apply all widths in final pass
|
|
// Apply all widths in final pass
|
|
|
_fnApplyToChildren( function(nToSize, i) {
|
|
_fnApplyToChildren( function(nToSize, i) {
|
|
|
- // Only apply widths to the DataTables detected header cells - this
|
|
|
|
|
- // prevents complex headers from having contradictory sizes applied
|
|
|
|
|
- if ( $.inArray( nToSize, dtHeaderCells ) !== -1 ) {
|
|
|
|
|
- nToSize.style.width = headerWidths[i];
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ nToSize.style.width = headerWidths[i];
|
|
|
}, headerTrgEls );
|
|
}, headerTrgEls );
|
|
|
|
|
|
|
|
$(headerSrcEls).height(0);
|
|
$(headerSrcEls).height(0);
|
|
@@ -6350,11 +6374,6 @@
|
|
|
*/
|
|
*/
|
|
|
function _fnSaveState ( settings )
|
|
function _fnSaveState ( settings )
|
|
|
{
|
|
{
|
|
|
- if ( !settings.oFeatures.bStateSave || settings.bDestroying )
|
|
|
|
|
- {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
/* Store the interesting variables */
|
|
/* Store the interesting variables */
|
|
|
var state = {
|
|
var state = {
|
|
|
time: +new Date(),
|
|
time: +new Date(),
|
|
@@ -6370,10 +6389,13 @@
|
|
|
} )
|
|
} )
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- _fnCallbackFire( settings, "aoStateSaveParams", 'stateSaveParams', [settings, state] );
|
|
|
|
|
-
|
|
|
|
|
settings.oSavedState = state;
|
|
settings.oSavedState = state;
|
|
|
- settings.fnStateSaveCallback.call( settings.oInstance, settings, state );
|
|
|
|
|
|
|
+ _fnCallbackFire( settings, "aoStateSaveParams", 'stateSaveParams', [settings, state] );
|
|
|
|
|
+
|
|
|
|
|
+ if ( settings.oFeatures.bStateSave && !settings.bDestroying )
|
|
|
|
|
+ {
|
|
|
|
|
+ settings.fnStateSaveCallback.call( settings.oInstance, settings, state );
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -7872,7 +7894,7 @@
|
|
|
_range( 0, displayMaster.length );
|
|
_range( 0, displayMaster.length );
|
|
|
}
|
|
}
|
|
|
else if ( page == 'current' ) {
|
|
else if ( page == 'current' ) {
|
|
|
- // Current page implies that order=current and fitler=applied, since it is
|
|
|
|
|
|
|
+ // Current page implies that order=current and filter=applied, since it is
|
|
|
// fairly senseless otherwise, regardless of what order and search actually
|
|
// fairly senseless otherwise, regardless of what order and search actually
|
|
|
// are
|
|
// are
|
|
|
for ( i=settings._iDisplayStart, ien=settings.fnDisplayEnd() ; i<ien ; i++ ) {
|
|
for ( i=settings._iDisplayStart, ien=settings.fnDisplayEnd() ; i<ien ; i++ ) {
|
|
@@ -8253,6 +8275,24 @@
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ $(document).on('plugin-init.dt', function (e, context) {
|
|
|
|
|
+ var api = new _Api( context );
|
|
|
|
|
+ api.on( 'stateSaveParams', function ( e, settings, data ) {
|
|
|
|
|
+ var indexes = api.rows().iterator( 'row', function ( settings, idx ) {
|
|
|
|
|
+ return settings.aoData[idx]._detailsShow ? idx : undefined;
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ data.childRows = api.rows( indexes ).ids( true ).toArray();
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ var loaded = api.state.loaded();
|
|
|
|
|
+
|
|
|
|
|
+ if ( loaded && loaded.childRows ) {
|
|
|
|
|
+ api.rows( loaded.childRows ).every( function () {
|
|
|
|
|
+ _fnCallbackFire( context, null, 'requestChild', [ this ] )
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
var __details_add = function ( ctx, row, data, klass )
|
|
var __details_add = function ( ctx, row, data, klass )
|
|
|
{
|
|
{
|
|
@@ -8311,6 +8351,8 @@
|
|
|
|
|
|
|
|
row._detailsShow = undefined;
|
|
row._detailsShow = undefined;
|
|
|
row._details = undefined;
|
|
row._details = undefined;
|
|
|
|
|
+ $( row.nTr ).removeClass( 'dt-hasChild' );
|
|
|
|
|
+ _fnSaveState( ctx[0] );
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
@@ -8327,12 +8369,17 @@
|
|
|
|
|
|
|
|
if ( show ) {
|
|
if ( show ) {
|
|
|
row._details.insertAfter( row.nTr );
|
|
row._details.insertAfter( row.nTr );
|
|
|
|
|
+ $( row.nTr ).addClass( 'dt-hasChild' );
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
row._details.detach();
|
|
row._details.detach();
|
|
|
|
|
+ $( row.nTr ).removeClass( 'dt-hasChild' );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ _fnCallbackFire( ctx[0], null, 'childRow', [ show, api.row( api[0] ) ] )
|
|
|
|
|
+
|
|
|
__details_events( ctx[0] );
|
|
__details_events( ctx[0] );
|
|
|
|
|
+ _fnSaveState( ctx[0] );
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
@@ -9543,7 +9590,7 @@
|
|
|
* @type string
|
|
* @type string
|
|
|
* @default Version number
|
|
* @default Version number
|
|
|
*/
|
|
*/
|
|
|
- DataTable.version = "1.10.25";
|
|
|
|
|
|
|
+ DataTable.version = "1.11.2";
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Private data store, containing all of the settings objects that are
|
|
* Private data store, containing all of the settings objects that are
|
|
@@ -9603,7 +9650,15 @@
|
|
|
* @type boolean
|
|
* @type boolean
|
|
|
* @default true
|
|
* @default true
|
|
|
*/
|
|
*/
|
|
|
- "bSmart": true
|
|
|
|
|
|
|
+ "bSmart": true,
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Flag to indicate if DataTables should only trigger a search when
|
|
|
|
|
+ * the return key is pressed.
|
|
|
|
|
+ * @type boolean
|
|
|
|
|
+ * @default false
|
|
|
|
|
+ */
|
|
|
|
|
+ "return": false
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
@@ -12499,7 +12554,7 @@
|
|
|
* "data": function ( source, type, val ) {
|
|
* "data": function ( source, type, val ) {
|
|
|
* if (type === 'set') {
|
|
* if (type === 'set') {
|
|
|
* source.price = val;
|
|
* source.price = val;
|
|
|
- * // Store the computed dislay and filter values for efficiency
|
|
|
|
|
|
|
+ * // Store the computed display and filter values for efficiency
|
|
|
* source.price_display = val=="" ? "" : "$"+numberFormat(val);
|
|
* source.price_display = val=="" ? "" : "$"+numberFormat(val);
|
|
|
* source.price_filter = val=="" ? "" : "$"+numberFormat(val)+" "+val;
|
|
* source.price_filter = val=="" ? "" : "$"+numberFormat(val)+" "+val;
|
|
|
* return;
|
|
* return;
|
|
@@ -13048,7 +13103,7 @@
|
|
|
* Delay the creation of TR and TD elements until they are actually
|
|
* Delay the creation of TR and TD elements until they are actually
|
|
|
* needed by a driven page draw. This can give a significant speed
|
|
* needed by a driven page draw. This can give a significant speed
|
|
|
* increase for Ajax source and Javascript source data, but makes no
|
|
* increase for Ajax source and Javascript source data, but makes no
|
|
|
- * difference at all fro DOM and server-side processing tables.
|
|
|
|
|
|
|
+ * difference at all for DOM and server-side processing tables.
|
|
|
* Note that this parameter will be set by the initialisation routine. To
|
|
* Note that this parameter will be set by the initialisation routine. To
|
|
|
* set a default use {@link DataTable.defaults}.
|
|
* set a default use {@link DataTable.defaults}.
|
|
|
* @type boolean
|
|
* @type boolean
|
|
@@ -13960,7 +14015,7 @@
|
|
|
*
|
|
*
|
|
|
* @type string
|
|
* @type string
|
|
|
*/
|
|
*/
|
|
|
- build:"bs5/dt-1.10.25",
|
|
|
|
|
|
|
+ build:"bs5/dt-1.11.2",
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -14406,7 +14461,7 @@
|
|
|
|
|
|
|
|
//
|
|
//
|
|
|
// Depreciated
|
|
// Depreciated
|
|
|
- // The following properties are retained for backwards compatiblity only.
|
|
|
|
|
|
|
+ // The following properties are retained for backwards compatibility only.
|
|
|
// The should not be used in new projects and will be removed in a future
|
|
// The should not be used in new projects and will be removed in a future
|
|
|
// version
|
|
// version
|
|
|
//
|
|
//
|
|
@@ -15226,170 +15281,7 @@
|
|
|
$.fn.DataTable[ prop ] = val;
|
|
$.fn.DataTable[ prop ] = val;
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- // Information about events fired by DataTables - for documentation.
|
|
|
|
|
- /**
|
|
|
|
|
- * Draw event, fired whenever the table is redrawn on the page, at the same
|
|
|
|
|
- * point as fnDrawCallback. This may be useful for binding events or
|
|
|
|
|
- * performing calculations when the table is altered at all.
|
|
|
|
|
- * @name DataTable#draw.dt
|
|
|
|
|
- * @event
|
|
|
|
|
- * @param {event} e jQuery event object
|
|
|
|
|
- * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
|
|
|
|
|
- */
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * Search event, fired when the searching applied to the table (using the
|
|
|
|
|
- * built-in global search, or column filters) is altered.
|
|
|
|
|
- * @name DataTable#search.dt
|
|
|
|
|
- * @event
|
|
|
|
|
- * @param {event} e jQuery event object
|
|
|
|
|
- * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
|
|
|
|
|
- */
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * Page change event, fired when the paging of the table is altered.
|
|
|
|
|
- * @name DataTable#page.dt
|
|
|
|
|
- * @event
|
|
|
|
|
- * @param {event} e jQuery event object
|
|
|
|
|
- * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
|
|
|
|
|
- */
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * Order event, fired when the ordering applied to the table is altered.
|
|
|
|
|
- * @name DataTable#order.dt
|
|
|
|
|
- * @event
|
|
|
|
|
- * @param {event} e jQuery event object
|
|
|
|
|
- * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
|
|
|
|
|
- */
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * DataTables initialisation complete event, fired when the table is fully
|
|
|
|
|
- * drawn, including Ajax data loaded, if Ajax data is required.
|
|
|
|
|
- * @name DataTable#init.dt
|
|
|
|
|
- * @event
|
|
|
|
|
- * @param {event} e jQuery event object
|
|
|
|
|
- * @param {object} oSettings DataTables settings object
|
|
|
|
|
- * @param {object} json The JSON object request from the server - only
|
|
|
|
|
- * present if client-side Ajax sourced data is used</li></ol>
|
|
|
|
|
- */
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * State save event, fired when the table has changed state a new state save
|
|
|
|
|
- * is required. This event allows modification of the state saving object
|
|
|
|
|
- * prior to actually doing the save, including addition or other state
|
|
|
|
|
- * properties (for plug-ins) or modification of a DataTables core property.
|
|
|
|
|
- * @name DataTable#stateSaveParams.dt
|
|
|
|
|
- * @event
|
|
|
|
|
- * @param {event} e jQuery event object
|
|
|
|
|
- * @param {object} oSettings DataTables settings object
|
|
|
|
|
- * @param {object} json The state information to be saved
|
|
|
|
|
- */
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * State load event, fired when the table is loading state from the stored
|
|
|
|
|
- * data, but prior to the settings object being modified by the saved state
|
|
|
|
|
- * - allowing modification of the saved state is required or loading of
|
|
|
|
|
- * state for a plug-in.
|
|
|
|
|
- * @name DataTable#stateLoadParams.dt
|
|
|
|
|
- * @event
|
|
|
|
|
- * @param {event} e jQuery event object
|
|
|
|
|
- * @param {object} oSettings DataTables settings object
|
|
|
|
|
- * @param {object} json The saved state information
|
|
|
|
|
- */
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * State loaded event, fired when state has been loaded from stored data and
|
|
|
|
|
- * the settings object has been modified by the loaded data.
|
|
|
|
|
- * @name DataTable#stateLoaded.dt
|
|
|
|
|
- * @event
|
|
|
|
|
- * @param {event} e jQuery event object
|
|
|
|
|
- * @param {object} oSettings DataTables settings object
|
|
|
|
|
- * @param {object} json The saved state information
|
|
|
|
|
- */
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * Processing event, fired when DataTables is doing some kind of processing
|
|
|
|
|
- * (be it, order, search or anything else). It can be used to indicate to
|
|
|
|
|
- * the end user that there is something happening, or that something has
|
|
|
|
|
- * finished.
|
|
|
|
|
- * @name DataTable#processing.dt
|
|
|
|
|
- * @event
|
|
|
|
|
- * @param {event} e jQuery event object
|
|
|
|
|
- * @param {object} oSettings DataTables settings object
|
|
|
|
|
- * @param {boolean} bShow Flag for if DataTables is doing processing or not
|
|
|
|
|
- */
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * Ajax (XHR) event, fired whenever an Ajax request is completed from a
|
|
|
|
|
- * request to made to the server for new data. This event is called before
|
|
|
|
|
- * DataTables processed the returned data, so it can also be used to pre-
|
|
|
|
|
- * process the data returned from the server, if needed.
|
|
|
|
|
- *
|
|
|
|
|
- * Note that this trigger is called in `fnServerData`, if you override
|
|
|
|
|
- * `fnServerData` and which to use this event, you need to trigger it in you
|
|
|
|
|
- * success function.
|
|
|
|
|
- * @name DataTable#xhr.dt
|
|
|
|
|
- * @event
|
|
|
|
|
- * @param {event} e jQuery event object
|
|
|
|
|
- * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
|
|
|
|
|
- * @param {object} json JSON returned from the server
|
|
|
|
|
- *
|
|
|
|
|
- * @example
|
|
|
|
|
- * // Use a custom property returned from the server in another DOM element
|
|
|
|
|
- * $('#table').dataTable().on('xhr.dt', function (e, settings, json) {
|
|
|
|
|
- * $('#status').html( json.status );
|
|
|
|
|
- * } );
|
|
|
|
|
- *
|
|
|
|
|
- * @example
|
|
|
|
|
- * // Pre-process the data returned from the server
|
|
|
|
|
- * $('#table').dataTable().on('xhr.dt', function (e, settings, json) {
|
|
|
|
|
- * for ( var i=0, ien=json.aaData.length ; i<ien ; i++ ) {
|
|
|
|
|
- * json.aaData[i].sum = json.aaData[i].one + json.aaData[i].two;
|
|
|
|
|
- * }
|
|
|
|
|
- * // Note no return - manipulate the data directly in the JSON object.
|
|
|
|
|
- * } );
|
|
|
|
|
- */
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * Destroy event, fired when the DataTable is destroyed by calling fnDestroy
|
|
|
|
|
- * or passing the bDestroy:true parameter in the initialisation object. This
|
|
|
|
|
- * can be used to remove bound events, added DOM nodes, etc.
|
|
|
|
|
- * @name DataTable#destroy.dt
|
|
|
|
|
- * @event
|
|
|
|
|
- * @param {event} e jQuery event object
|
|
|
|
|
- * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
|
|
|
|
|
- */
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * Page length change event, fired when number of records to show on each
|
|
|
|
|
- * page (the length) is changed.
|
|
|
|
|
- * @name DataTable#length.dt
|
|
|
|
|
- * @event
|
|
|
|
|
- * @param {event} e jQuery event object
|
|
|
|
|
- * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
|
|
|
|
|
- * @param {integer} len New length
|
|
|
|
|
- */
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * Column sizing has changed.
|
|
|
|
|
- * @name DataTable#column-sizing.dt
|
|
|
|
|
- * @event
|
|
|
|
|
- * @param {event} e jQuery event object
|
|
|
|
|
- * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
|
|
|
|
|
- */
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * Column visibility has changed.
|
|
|
|
|
- * @name DataTable#column-visibility.dt
|
|
|
|
|
- * @event
|
|
|
|
|
- * @param {event} e jQuery event object
|
|
|
|
|
- * @param {object} o DataTables settings object {@link DataTable.models.oSettings}
|
|
|
|
|
- * @param {int} column Column index
|
|
|
|
|
- * @param {bool} vis `false` if column now hidden, or `true` if visible
|
|
|
|
|
- */
|
|
|
|
|
-
|
|
|
|
|
- return $.fn.dataTable;
|
|
|
|
|
|
|
+ return DataTable;
|
|
|
}));
|
|
}));
|
|
|
|
|
|
|
|
|
|
|