Issue with array field
Issue with array field
ukman
Posts: 1Questions: 0Answers: 0
Hello,
I have a problem with the following example. Here two column that displays data from array.
It works fine when marked line is commented, but when it's uncommented, all data from columns "Car Models" and "Car Years" disappear.
[code]
var data = [
{
id : 1,
name : "Jack",
cars : [
{
name : "Mercedez",
year : 1960
},
{
name : "Ferrari",
year : 1965
}
]
},
];
$(document).ready(function(){
$('#example').dataTable( {
aaData : data,
aoColumns: [
{ "mData": "id", "sTitle": "ID"},
{ "mData": "name", "sTitle": "Name"},
{ "mData": "cars[].name", "sTitle": "Car Models"},
//////////////////////////////////////////////////////// PROBLEM IS HERE
{ "mData": "cars[].year", "sTitle": "Car Years"}, // COMMENT/UCOMMENT THIS LINE
////////////////////////////////////////////////////////
],
});
});
[/code]
Ready example is here
http://jsfiddle.net/Ah26y/
I have a problem with the following example. Here two column that displays data from array.
It works fine when marked line is commented, but when it's uncommented, all data from columns "Car Models" and "Car Years" disappear.
[code]
var data = [
{
id : 1,
name : "Jack",
cars : [
{
name : "Mercedez",
year : 1960
},
{
name : "Ferrari",
year : 1965
}
]
},
];
$(document).ready(function(){
$('#example').dataTable( {
aaData : data,
aoColumns: [
{ "mData": "id", "sTitle": "ID"},
{ "mData": "name", "sTitle": "Name"},
{ "mData": "cars[].name", "sTitle": "Car Models"},
//////////////////////////////////////////////////////// PROBLEM IS HERE
{ "mData": "cars[].year", "sTitle": "Car Years"}, // COMMENT/UCOMMENT THIS LINE
////////////////////////////////////////////////////////
],
});
});
[/code]
Ready example is here
http://jsfiddle.net/Ah26y/
This discussion has been closed.
Replies
Allan