mirror of
https://github.com/DataTables/DataTables.git
synced 2025-02-28 01:54:15 +01:00
Fix: When fnUpdate is called with a column index given, assume that the update is for an individual cell (which the API call has specified, so this is the correct thing to do). This also lets us tidy up some of the code in fnUpate, partiuclarly when regarding deeply nested options.
This commit is contained in:
parent
a022e2f736
commit
56b0d11c96
8
media/js/jquery.dataTables.js
vendored
8
media/js/jquery.dataTables.js
vendored
@ -5993,30 +5993,26 @@
|
||||
var iRow = (typeof mRow === 'object') ?
|
||||
_fnNodeToDataIndex(oSettings, mRow) : mRow;
|
||||
|
||||
if ( oSettings.__fnUpdateDeep === undefined && $.isArray(mData) && typeof mData === 'object' )
|
||||
if ( $.isArray(mData) && iColumn === undefined )
|
||||
{
|
||||
/* Array update - update the whole row */
|
||||
oSettings.aoData[iRow]._aData = mData.slice();
|
||||
|
||||
/* Flag to the function that we are recursing */
|
||||
oSettings.__fnUpdateDeep = true;
|
||||
for ( i=0 ; i<oSettings.aoColumns.length ; i++ )
|
||||
{
|
||||
this.fnUpdate( _fnGetCellData( oSettings, iRow, i ), iRow, i, false, false );
|
||||
}
|
||||
oSettings.__fnUpdateDeep = undefined;
|
||||
}
|
||||
else if ( oSettings.__fnUpdateDeep === undefined && mData !== null && typeof mData === 'object' )
|
||||
else if ( $.isPlainObject(mData) && iColumn === undefined )
|
||||
{
|
||||
/* Object update - update the whole row - assume the developer gets the object right */
|
||||
oSettings.aoData[iRow]._aData = $.extend( true, {}, mData );
|
||||
|
||||
oSettings.__fnUpdateDeep = true;
|
||||
for ( i=0 ; i<oSettings.aoColumns.length ; i++ )
|
||||
{
|
||||
this.fnUpdate( _fnGetCellData( oSettings, iRow, i ), iRow, i, false, false );
|
||||
}
|
||||
oSettings.__fnUpdateDeep = undefined;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1186,30 +1186,26 @@ this.fnUpdate = function( mData, mRow, iColumn, bRedraw, bAction )
|
||||
var iRow = (typeof mRow === 'object') ?
|
||||
_fnNodeToDataIndex(oSettings, mRow) : mRow;
|
||||
|
||||
if ( oSettings.__fnUpdateDeep === undefined && $.isArray(mData) && typeof mData === 'object' )
|
||||
if ( $.isArray(mData) && iColumn === undefined )
|
||||
{
|
||||
/* Array update - update the whole row */
|
||||
oSettings.aoData[iRow]._aData = mData.slice();
|
||||
|
||||
/* Flag to the function that we are recursing */
|
||||
oSettings.__fnUpdateDeep = true;
|
||||
for ( i=0 ; i<oSettings.aoColumns.length ; i++ )
|
||||
{
|
||||
this.fnUpdate( _fnGetCellData( oSettings, iRow, i ), iRow, i, false, false );
|
||||
}
|
||||
oSettings.__fnUpdateDeep = undefined;
|
||||
}
|
||||
else if ( oSettings.__fnUpdateDeep === undefined && mData !== null && typeof mData === 'object' )
|
||||
else if ( $.isPlainObject(mData) && iColumn === undefined )
|
||||
{
|
||||
/* Object update - update the whole row - assume the developer gets the object right */
|
||||
oSettings.aoData[iRow]._aData = $.extend( true, {}, mData );
|
||||
|
||||
oSettings.__fnUpdateDeep = true;
|
||||
for ( i=0 ; i<oSettings.aoColumns.length ; i++ )
|
||||
{
|
||||
this.fnUpdate( _fnGetCellData( oSettings, iRow, i ), iRow, i, false, false );
|
||||
}
|
||||
oSettings.__fnUpdateDeep = undefined;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user