Display selected rows in a div from localStorage
Display selected rows in a div from localStorage
potato_code
Posts: 14Questions: 5Answers: 0
Hi, I'm using Select with stateSave in localStorage.
How can I display the selected rows in another table with a button click?
here is my test case - live.datatables.net/jisokuvu/31/
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
See if this example helps:
https://datatables.net/extensions/select/examples/api/get.html
You can use
rows().data()
to get the data for the selected rows, for exampletable.rows( { selected: true } ).data();
. Then you can place them where you like.Kevin
Hi, Thank you for answering. Unfortunately, I'm not sure how to append the data to the new table. I get back [object Object] when I click on the button.
updated live.datatables.net/qapeleso/6/
I also added buttons extensions to make things easier.
I updated your example to show how to get the selected rows and add to the 2nd table. I added the checkbox column to make sure the number of columns match. If you don't want the checkbox or column or other columns you can use
columns.visible
or you can userows().every()
to iterate all the rows an remove the columns you don't want.http://live.datatables.net/qapeleso/7/edit
Kevin
Hi, Thank you for your example. It works!