Enable REMOVE button when 1 or more rows selected but disable the EDIT button when multiple
Enable REMOVE button when 1 or more rows selected but disable the EDIT button when multiple
I have three buttons:
buttons : [
{extend: 'create', editor: editor },
{extend: 'edit', editor: editor },
{extend: 'delete', editor: editor },
]
And I'm using
select: {
style: 'os',
selector: 'td:first-child'
},
I tried 'single' but then I can only select on row at a time. I'd like to be able to select multiple rows for deleting.
I need to enabled the edit button when exactly 1 (and only 1) row is selected.
AND I need to enable Remove button when 1 or more rows selected.
Can this be done? If so how? (An example would be nice)
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You could try the selectedSingle button.
https://datatables.net/reference/button/selectedSingle
it is enabled when only one row is selected
Never mind I found a solution: Just had to define the button using selectedSingle (only enabled when a single row is selected) and then tell editor to pop up, with some options, when the button is clicked.