Reputation: 5601
I generate a DataTable thanks the plug-in dataTables and I assign a id to each row
table = $('#example').DataTable({
"data": source_dataTable,
"columns": columns,
"columnDefs": defs,
'fnCreatedRow': function (nRow, aData, iDataIndex) {
$(nRow).attr('id', aData[0]);//assign an id
},
"language": {
"url": dataTabe_text_source
}
});
I want to now programically deselect (and why not select) rows IDENTIFIED FROM THEIR ID
I want to do it from id in something like that
table.Deselect(id);
If you have the tip , could you help me please?
Upvotes: 1
Views: 4114
Reputation: 12748
I looked for correct syntax at http://www.datatables.net/examples/api/select_single_row.html and found that my example should be like:
var table = $('#example').DataTable();
table.$('tr#row-42').removeClass('selected');
This reference is giving correct type of object where addClass and removeClass would apply.
Upvotes: 3