mirror of
https://github.com/DataTables/DataTables.git
synced 2025-02-28 01:54:15 +01:00
Fix: When setting deeply nested object properties, where the parent object doesn't yet exist, don't just silently fail. Since we are setting a value, we are at liberty to create the parent object and then set the value - this now does so.
This commit is contained in:
parent
29e0d112cb
commit
284658e3c9
8
media/js/jquery.dataTables.js
vendored
8
media/js/jquery.dataTables.js
vendored
@ -865,11 +865,13 @@
|
||||
return function (data, val) {
|
||||
for ( var i=0, iLen=a.length-1 ; i<iLen ; i++ )
|
||||
{
|
||||
data = data[ a[i] ];
|
||||
if ( data === undefined )
|
||||
// If the nested object doesn't currently exist - since we are
|
||||
// trying to set the value - create it
|
||||
if ( data[ a[i] ] === undefined )
|
||||
{
|
||||
return;
|
||||
data[ a[i] ] = {};
|
||||
}
|
||||
data = data[ a[i] ];
|
||||
}
|
||||
data[ a[a.length-1] ] = val;
|
||||
};
|
||||
|
@ -440,11 +440,13 @@ function _fnSetObjectDataFn( mSource )
|
||||
return function (data, val) {
|
||||
for ( var i=0, iLen=a.length-1 ; i<iLen ; i++ )
|
||||
{
|
||||
data = data[ a[i] ];
|
||||
if ( data === undefined )
|
||||
// If the nested object doesn't currently exist - since we are
|
||||
// trying to set the value - create it
|
||||
if ( data[ a[i] ] === undefined )
|
||||
{
|
||||
return;
|
||||
data[ a[i] ] = {};
|
||||
}
|
||||
data = data[ a[i] ];
|
||||
}
|
||||
data[ a[a.length-1] ] = val;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user