rows.select,rows.deselect api does not work. Is there an extension or js file that needs to be added
rows.select,rows.deselect api does not work. Is there an extension or js file that needs to be added
chita
Posts: 33Questions: 12Answers: 2
$(".selectAll").on( "click", function(e) {
if ($(this).is( ":checked" )) {
$('#example').rows({page:'current'}).select();
console.log('select');
} else {
$('#example').rows({page:'current'}).deselect();
console.log('deselect');
}
});
I've tried using a new code that says it's valid by looking around the example of full checkbox selection in the forum, but it doesn't work. What's the reason?
This question has an accepted answers - jump to answer
Answers
The current Uncaught TypeError: $(...).rows is not a function error.
You need to reference the DataTables object first:
and likewise for the
row().deselect()
,Colin
If you change to that syntax, a new table is created in the space where the table was located, and the Uncaught TypeError: $(...).DataTable(...).rows(...).select is not a function error remains. Is there a css or js file or npm package that I need to add to use that function?
There was a problem with the table object declaration. After the modification, I applied the code you told me, so it works normally. However, the check box is not active, although the entire row is selected. What should I do? The row checkbox implementation used this example.
The example you linked to doesn't use the checkboxes for row selection - it uses it to indicate the value of a field and to let the user change that value without entering into an edit mode.
This example demonstrates Selects` checkbox option, and this example shows it being used with Editor.
Allan