是否可以在不使用循环的情况下从removeClass
致电所有nodes
上的DataTable
?
var selectedNodes = dataTable.rows('.' + rowSelectedClass).nodes();
selectedNodes.each(function (value, index) { // works, but have to use each
$(value).removeClass(rowSelectedClass);
});
// selectedNodes.removeClass(rowSelectedClass); // selectedNodes.removeClass is not a function
// selectedNodes.items().removeClass(rowSelectedClass); // Is something like this possible?
解决方案 来自@annoyingmouse
dataTable.rows('.' + rowSelectedClass).nodes().to$().removeClass('rowSelectedClass');
答案 0 :(得分:1)