Best way to count number of selected rows?
Best way to count number of selected rows?

I want to activate a button outside of the table if one (and only one!) row is selected. We've tried this:
searchTable.rows('.selected').data().length
But this doesn't work as it reports 2 selected if I just click another row. It reports correctly if I first deselect my current row, and then select another. But I can't expect my customers to do that, they'll just click another row...
This discussion has been closed.
Answers
Are you saying you want to allow only one row at a time to be selected? You can do this by setting the
select.style
to single.Kevin
You can use the
selector-modifier
forrows()
, and do something likerows({selected:true}).length
,Colin