Output filtered results
Output filtered results
flowte
Posts: 21Questions: 6Answers: 0
in DataTables
I want the user to be able to use the filters on a datatable to get a particular list and then output the ids of each row of the list to a javascript / jquery / ajax function to do something with it. Is this possible?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I don't see why not. Use
columns().search()
for a column level filter androws().ids()
to get the ids.Allan
would I use that as part of an external function?
To be honest I'm not sure what that means. Those are the API methods that you would call to trigger searching on columns and also to get the ids of rows.
Allan
What I'm trying to do is allow the user to use the filters on the datatable and when they have a list as they want it to click a button on the screen which then makes use of all ids for each row and pass them through a separate function
Did you look into
rows().ids()
. That sounds like exactly what you want. Get the ids of the rows in the table when your click event is activated.Allan
I'm using it but what it is outputting is all ids prior to filtering. i.e. I start with 30 items on the list, use filters which then displays 5 items but when I use the rows().ids() it outputs all 30 items. Am I missing something?
You need to use the
selector-modifier
option to get only the filtered rows:Allan
gerr, hate when it is something simple. Thanks for your help!