Select Buttons and checkboxes
Select Buttons and checkboxes
Hello,
I would like to use the select-buttons, like described in https://datatables.net/extensions/select/examples/initialisation/buttons.html. While this works fine, I would like to also have checkboxes inside, like described in https://datatables.net/extensions/select/examples/initialisation/checkbox.html. My problem is now, that each of them works fine, but not in a combination. When i add the buttons like this:
buttons: [
'selectNone',
{
extend: 'selectColumns',
'selector': 'td:not:first-child',
style: 'os'
},
{
extend: 'selectRows',
'style': 'multi',
'selector': 'td:first-child',
'className': 'selected-row selected',
},
{
extend: 'selectCells',
'selector': 'td:not:first-child',
style: 'os'
},
none is working, but when I outsource select, like this:
select: {
'style': 'multi',
'selector': 'td:first-child',
'className': 'selected-row selected'
},
checkboxes just work fine. Any idea how to solve this????
Thanx :-)
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
Answers
You can't have the
select.selectoroption set to betd:first-childand still be able to select any cells other than the first column.Could you explain what it is that you are looking to do please?
Thanks,
Allan
Hello,
I would like to have checkboxes in the first row, but also be able to select column-, row- or cell-wise. Is that possible?
Thank you,
Andy
Yes. What I would suggest is that you set up your table like the example where you can change the selection item - then add another column into the table for the checkboxes. Instead of used Select to control the checkboxes automatically, assign your own event listener for them which will call
row().select(), so the row can be selected regardless of which item type is being selected from the buttons.Allan