mirror of
https://github.com/DataTables/DataTables.git
synced 2025-01-30 23:52:11 +01:00
Fix - API: $ method, when used with defered rendering, when all rows have not been rendered, results in jQUery trying to perform a selector on 'null' which throws an error. Now check for the tr having being created before adding it to the array to pass to jQuery - 8862
This commit is contained in:
parent
90edd0bd94
commit
391cd6a7a6
42
media/js/jquery.dataTables.js
vendored
42
media/js/jquery.dataTables.js
vendored
@ -4817,8 +4817,11 @@
|
||||
*/
|
||||
this.$ = function ( sSelector, oOpts )
|
||||
{
|
||||
var i, iLen, a = [];
|
||||
var i, iLen, a = [], tr;
|
||||
var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
|
||||
var aoData = oSettings.aoData;
|
||||
var aiDisplay = oSettings.aiDisplay;
|
||||
var aiDisplayMaster = oSettings.aiDisplayMaster;
|
||||
|
||||
if ( !oOpts )
|
||||
{
|
||||
@ -4837,37 +4840,54 @@
|
||||
{
|
||||
for ( i=oSettings._iDisplayStart, iLen=oSettings.fnDisplayEnd() ; i<iLen ; i++ )
|
||||
{
|
||||
a.push( oSettings.aoData[ oSettings.aiDisplay[i] ].nTr );
|
||||
tr = aoData[ aiDisplay[i] ].nTr;
|
||||
if ( tr )
|
||||
{
|
||||
a.push( tr );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( oOpts.order == "current" && oOpts.filter == "none" )
|
||||
{
|
||||
for ( i=0, iLen=oSettings.aiDisplayMaster.length ; i<iLen ; i++ )
|
||||
for ( i=0, iLen=aiDisplayMaster.length ; i<iLen ; i++ )
|
||||
{
|
||||
a.push( oSettings.aoData[ oSettings.aiDisplayMaster[i] ].nTr );
|
||||
tr = aoData[ aiDisplayMaster[i] ].nTr;
|
||||
if ( tr )
|
||||
{
|
||||
a.push( tr );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( oOpts.order == "current" && oOpts.filter == "applied" )
|
||||
{
|
||||
for ( i=0, iLen=oSettings.aiDisplay.length ; i<iLen ; i++ )
|
||||
for ( i=0, iLen=aiDisplay.length ; i<iLen ; i++ )
|
||||
{
|
||||
a.push( oSettings.aoData[ oSettings.aiDisplay[i] ].nTr );
|
||||
tr = aoData[ aiDisplay[i] ].nTr;
|
||||
if ( tr )
|
||||
{
|
||||
a.push( tr );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( oOpts.order == "original" && oOpts.filter == "none" )
|
||||
{
|
||||
for ( i=0, iLen=oSettings.aoData.length ; i<iLen ; i++ )
|
||||
for ( i=0, iLen=aoData.length ; i<iLen ; i++ )
|
||||
{
|
||||
a.push( oSettings.aoData[ i ].nTr );
|
||||
tr = aoData[ i ].nTr ;
|
||||
if ( tr )
|
||||
{
|
||||
a.push( tr );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( oOpts.order == "original" && oOpts.filter == "applied" )
|
||||
{
|
||||
for ( i=0, iLen=oSettings.aoData.length ; i<iLen ; i++ )
|
||||
for ( i=0, iLen=aoData.length ; i<iLen ; i++ )
|
||||
{
|
||||
if ( $.inArray( i, oSettings.aiDisplay ) !== -1 )
|
||||
tr = aoData[ i ].nTr;
|
||||
if ( $.inArray( i, aiDisplay ) !== -1 && tr )
|
||||
{
|
||||
a.push( oSettings.aoData[ i ].nTr );
|
||||
a.push( tr );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,8 +37,11 @@
|
||||
*/
|
||||
this.$ = function ( sSelector, oOpts )
|
||||
{
|
||||
var i, iLen, a = [];
|
||||
var i, iLen, a = [], tr;
|
||||
var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
|
||||
var aoData = oSettings.aoData;
|
||||
var aiDisplay = oSettings.aiDisplay;
|
||||
var aiDisplayMaster = oSettings.aiDisplayMaster;
|
||||
|
||||
if ( !oOpts )
|
||||
{
|
||||
@ -57,37 +60,54 @@ this.$ = function ( sSelector, oOpts )
|
||||
{
|
||||
for ( i=oSettings._iDisplayStart, iLen=oSettings.fnDisplayEnd() ; i<iLen ; i++ )
|
||||
{
|
||||
a.push( oSettings.aoData[ oSettings.aiDisplay[i] ].nTr );
|
||||
tr = aoData[ aiDisplay[i] ].nTr;
|
||||
if ( tr )
|
||||
{
|
||||
a.push( tr );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( oOpts.order == "current" && oOpts.filter == "none" )
|
||||
{
|
||||
for ( i=0, iLen=oSettings.aiDisplayMaster.length ; i<iLen ; i++ )
|
||||
for ( i=0, iLen=aiDisplayMaster.length ; i<iLen ; i++ )
|
||||
{
|
||||
a.push( oSettings.aoData[ oSettings.aiDisplayMaster[i] ].nTr );
|
||||
tr = aoData[ aiDisplayMaster[i] ].nTr;
|
||||
if ( tr )
|
||||
{
|
||||
a.push( tr );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( oOpts.order == "current" && oOpts.filter == "applied" )
|
||||
{
|
||||
for ( i=0, iLen=oSettings.aiDisplay.length ; i<iLen ; i++ )
|
||||
for ( i=0, iLen=aiDisplay.length ; i<iLen ; i++ )
|
||||
{
|
||||
a.push( oSettings.aoData[ oSettings.aiDisplay[i] ].nTr );
|
||||
tr = aoData[ aiDisplay[i] ].nTr;
|
||||
if ( tr )
|
||||
{
|
||||
a.push( tr );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( oOpts.order == "original" && oOpts.filter == "none" )
|
||||
{
|
||||
for ( i=0, iLen=oSettings.aoData.length ; i<iLen ; i++ )
|
||||
for ( i=0, iLen=aoData.length ; i<iLen ; i++ )
|
||||
{
|
||||
a.push( oSettings.aoData[ i ].nTr );
|
||||
tr = aoData[ i ].nTr ;
|
||||
if ( tr )
|
||||
{
|
||||
a.push( tr );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( oOpts.order == "original" && oOpts.filter == "applied" )
|
||||
{
|
||||
for ( i=0, iLen=oSettings.aoData.length ; i<iLen ; i++ )
|
||||
for ( i=0, iLen=aoData.length ; i<iLen ; i++ )
|
||||
{
|
||||
if ( $.inArray( i, oSettings.aiDisplay ) !== -1 )
|
||||
tr = aoData[ i ].nTr;
|
||||
if ( $.inArray( i, aiDisplay ) !== -1 && tr )
|
||||
{
|
||||
a.push( oSettings.aoData[ i ].nTr );
|
||||
a.push( tr );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user