Using rowID option with object data
Using rowID option with object data
DataTables v1.10.9
I'd like to use rowID to assign an id to my tr's, but I can't seem to get it to work and the rowID example uses PHP, obscuring my ability to analyze it. Ultimately, I think the question boils down to... whats the format required for the 'data' property in order to make use of the 'rowID' property?
I'm assuming I can't use arrays since I can't specify columns so it must be objects, but I can't find an example on the site that uses objects (i'm sure there must be one).
As an example, I get a DT initialization error if I run the following code (modified from http://jsfiddle.net/j5a390d9/2/):
var dataset = [{ col1: 'test', col2: 15, col3: 'testDesc'}];
$('#MeterDataTable').DataTable(
{
"data": dataset,
"columns": [
{ "title": "meter" },
{ "title": "id" },
{ "title": "desc" }
],
"rowId": 'col1'
});
Can anyone help?
Thanks in advance,
GB
Answers
Corrected jsfiddle link (note, this is the original unedited jsfiddle)
http://jsfiddle.net/j5a390d9/2/