Select only two rows
Select only two rows
Andreas S.
Posts: 207Questions: 73Answers: 4
in Select
Is it possible to restrict the multi select for two rows?
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Yes - you could use the
user-select
event to cancel the addition of rows if two are already selected.Allan
I have used the code at the end to activate the button. Is with the 'user-select' event possible to activate and deactivated the button. I think so, but what is the different between both events. I did not found the description about the 'select' event.
This opens another problem for me. How get the data of the selected rows. I tried in the action of the Button to get the data of both selected rows, but only I get an error. With a single row I get the data.
Andreas
The
user-select
event should only be used to cancel selection if your logic requires that. You should useselect
to know when a row has actually been selected (i.e. it has been allowed byuser-select
or has been triggered via the API).would get the data. If that doesn't work, I'd need a link to a test case showing the issue. Also note that you would need to use
toArray()
to get a plain array of data if you are sending that via Ajax rather than a DataTables object.Allan