There seems to be no equivalent of
to enable a button only if more than one row is selected. I'm guessing there's a work-around, but I haven't figured it out.
This question has an accepted answers - jump to answer
I haven't used that option but I have used something like this example:
But in that example, selecting one row enables both buttons. I want at least two rows to be selected to enable a particular button.
How about if you change:
table.button( 0 ).enable( selectedRows === 1 );
table.button( 1 ).enable( selectedRows > 0 );
table.button( 1 ).enable( selectedRows > 1 );
This will enable button 1 when 2 or more rows are selected and disable if less than 2 are selected.
Yup - what Kevin says. You'd need your own buttons.buttons.init function here, which would add an event listener that checks the number of rows selected.
This is the code that Select uses for its selection event handler.
Thank you both! Up, up and away....
It looks like you're new here. If you want to get involved, click one of these buttons!
DataTables designed and created by SpryMedia Ltd.
SpryMedia Ltd is registered in Scotland, company no. SC456502.