Auto Column Headers?
Auto Column Headers?
I have DataTables currently pulling data from a JSON file and it's working great.
I'm wondering if the column headers can be generated from the JSON data as opposed to defined in the js.
What example or code samples should I be looking at to make this happen?
thank you.
I'm wondering if the column headers can be generated from the JSON data as opposed to defined in the js.
What example or code samples should I be looking at to make this happen?
thank you.
This discussion has been closed.
Replies
[code]
$.getJSON( 'source', null, function(json) {
$('whatever').dataTable( json );
} );
[/code]
Regards,
Allan
This worked. Thank you for the insight.
Thanks.
[code]
{
"aoColumns": [
{
"sTitle": "Rendering Engine"
},
{
"sTitle": "Browser"
},
{
"sTitle": "Platform(s)"
},
{
"sTitle": "Engine version"
},
{
"sTitle": "CSS grade"
}
],
"aaData": [
[
"Trident",
"Internet Explorer 4.0",
"Win 95+",
"4",
"X"
],
[
"Trident",
"Internet Explorer 5.0",
"Win 95+",
"5",
"C"
],
[
"Trident",
"Internet Explorer 5.5",
"Win 95+",
"5.5",
"A"
],
[
"Trident",
"Internet Explorer 6",
"Win 98+",
"6",
"A"
],
[
"Trident",
"Internet Explorer 7",
"Win XP SP2+",
"7",
"A"
],
[
"Trident",
"AOL browser (AOL desktop)",
"Win XP",
"6",
"A"
],
[
"Gecko",
"Firefox 1.0",
"Win 98+ / OSX.2+",
"1.7",
"A"
]
]
}
[/code]