datatable.row().node() addClass() does'n work
datatable.row().node() addClass() does'n work
beklight
Posts: 4Questions: 1Answers: 0
Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
var customerId = 5; //for example
var row = datable.row({id:customerId}).node();
$(row).addClass('selected');
//It selects first row which has id:0
//WHY it doesn't select row with id:5 ?
This question has an accepted answers - jump to answer
Answers
{id:customerId}
isn't something that therow-selector
supports. It's a nice idea for a future feature, but at this time you would need to do something like:Allan
Thank you very much. I found enother way to solve my issue but your version I gess better.
var customerId = 5;
table.rows().every(function(){
var customer = this.data();
if (customer.id === customerId) {
$(this.node()).addClass('selected');
}
})
The benefit of my version is performance. However, your own one does the job nicely as well - nice one!
Allan