Jquery function when selected the first row and if deselect all selections
Jquery function when selected the first row and if deselect all selections
This question has accepted answers - jump to:
This discussion has been closed.
This question has accepted answers - jump to:
Answers
select
anddeselect
are the two events you'd probably want to listen for here.Allan
Thanks for the fast response!
DataTables displays @ bottom of the table how many rows are selected. Is it possible to get this value?
I think
page.info()
is what you are looking for.Kevin
No, I'm not looking for the page. If I use multiselect the Datatables shows how many rows are selected.
I insert a simple counter which increase on select event and decrease on deselect. It works fine.
How I get the row ID from the selected rows? I tried the example but it dont work.
Sorry misread your question. This example shows how to get the selected row count:
https://datatables.net/extensions/select/examples/api/get.html
If you want just an array of data (without the API attached) you can use this:
Kevin
Thanks for the fast response!
But I don't get the row IDs with your example. Can you edit my code snipet to display the is?
Have you defined a column
id
usingcolumns.data
?Doesn't look like you have in the above code. If not then you need to change
pluck('id')
topluck( 0 )
. Replace the0
with your column number containing the 'id'.Kevin
Ok, so I get the column. Thanks, is there a way to get the 'id' from <tr id="XXX" ...
?
Its still unclear to me how you have everything setup but you could try using
rows().ids()
to get the ID's. Might not work in your case.You can use
rows().nodes()
to get thetr
nodes of the selected rows. This may help.Kevin