editor with multi select and disable button not working
editor with multi select and disable button not working
Hi
I am triing to disable the edit button when more than 1 row is selected
I have tried
.on("select", function (e, datatable, settings, processing) {
var selectedRows = datatable.rows( { selected: true } ).count();
if (selectedRows != 1) {
oTable.buttons( ).disable();
// datatable.button( 1 ).disable();
// datatable.button( "edit:name" ).disable();
} else {
datatable.button( "edit:name" ).disable( selectedRows != 1 );
datatable.button( "edit:name" ).enable( selectedRows === 1 );
}
})
The create button does become disable but not the edit or delete button
Thanks in advance
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
The best way to do this would actually be to use the
selectedSingle
button type. Let it do the button enable and disable actions for you and just define anaction
function that will triggeredit()
on the selected row when the button is activated (this button type can only be activated when a single row is selected).Editor's buttons extend the
selected
button, and they control their own enable / disable state, which is why you will be running into problems with the above approach.Allan
Hi Allan
Exactly what I was searching for
Thanks