[BUG] Error while loading object with a Dot in the associative array Key
[BUG] Error while loading object with a Dot in the associative array Key
Hello Together,
here a small bug Report:
I tried to Display a table with an dot in the Key.
In Function _fnGetObjectDataFn ( mSource ) I saw that the internal function fetchData modifies the src string and made an Array out of the Key if the string contains a dot.
I modified the last lines of this function like that:
if ( data === null || data[ a[i] ] === undefined && data[src] === undefined )
{
return undefined;
}
if(data[a[i]] === undefined)
{
return data[src];
}
data = data[a[i]];
That made it work for me.
The Array of Data:
[{"ID":"1","Value.Test":"T1"},{"ID":"2","Value.Test":"T2"},{"ID":"3","Value.Test":"T3"}]
The Array of Columns:
[{"data":"ID"},{"data":"Value.Test"}]
I hope that it is understandable the way I described it.
It would be nice if you can add this or something equal to the next verrsion of datatables.
Kind Regards
Matthias Mueller
Replies
What I forgot:
The Version of jquery.dataTables.js was DataTables 1.10.7
Kind Regards
Matthias Mueller
Hi Matthias,
This is actually expected and not a bug as DataTables uses the dot to be able to read nested data, as you would with any normal Javascript object.
To have it use a parameter that contains a dot in the name you need to just escape it in the
columns.data
string: http://live.datatables.net/qupodefa/1/editThis behaviour is documented in the reference.
Allan