How to set a row as selected based on index.
How to set a row as selected based on index.

Hi!
I don't know how to set the selected state of a row based on an index in the table.
Here is my code:
function processSelectedType(type) {
var dataTable= $('#commandtable').DataTable();
var size = dataTable.columns(0).data().eq(0).length;
for(var i=0;i<size;++i) {
var rowData = dataTable.rows().data();
if(rowData.data()[i].command.type===type){
dataTable.row(':eq('+i+')').toJQuery().toggleClass('selected');
}
}
// dataTable.redraw();
return false;
}
This discussion has been closed.
Answers
This solved my issue:
function processSelectedType(type) {
My final version: