1
0
mirror of https://github.com/DataTables/DataTables.git synced 2024-12-01 13:24:10 +01:00

Dev fix: _pluck should check that what is is accessing exists

- When using _pluck with deferred rendering, there were a number of
  errors due to the nTr element being undefined (that's what deferred
  rendering is all about of course). So the logic to check that pluck
  can pluck from a source object needs ot be added.
This commit is contained in:
Allan Jardine 2013-06-19 16:44:38 +01:00
parent 0142172027
commit 0d8282c61a

View File

@ -9,12 +9,16 @@ var _pluck = function ( a, prop, prop2 ) {
// is essential here // is essential here
if ( prop2 !== undefined ) { if ( prop2 !== undefined ) {
for ( ; i<ien ; i++ ) { for ( ; i<ien ; i++ ) {
out.push( a[i][ prop ][ prop2 ] ); if ( a[i] && a[i][ prop ] ) {
out.push( a[i][ prop ][ prop2 ] );
}
} }
} }
else { else {
for ( ; i<ien ; i++ ) { for ( ; i<ien ; i++ ) {
out.push( a[i][ prop ] ); if ( a[i] ) {
out.push( a[i][ prop ] );
}
} }
} }