How do I fetch data for column cells of selected rows?
How do I fetch data for column cells of selected rows?
I've installed the latest version of DataTables, added some of the extensions (buttons, select, etc.) and everything is working well, including the 'Select All' and 'Deselect All', buttons, Bootstrap formatting, etc. However, I'm at a loss as to how to fetch the data related to what rows have been selected. I need to pass the information to another page for server-side processing. I can see where I can do things like:
table.rows('.selected').data()
I could load that into a form field and submit the form via javascript, but I don't know what is contained in this object and I likely don't need all of the information as I don't need all of the tables data - I really just need data from a particular column cells (e.g. "User ID") for the selected rows.
Answers
ok, I implemented a solution for this which likely could have been done simpler if I knew what I was doing, but it worked:
Hi,
The way to do this is to use the
selected
option of theselector-modifier
object - for example:table.rows( { selected: true } ).data()
.This, and other details for how Select integrates with the DataTables API are available on this manual page.
Regards,
Allan