Generate a list containing the values that appear in the first column of a filtered dataTable
Generate a list containing the values that appear in the first column of a filtered dataTable
lc180
Posts: 7Questions: 3Answers: 0
Pretty much what the title says. I have a button on screen, when I click it I call a function, inside the function I create an arraylist and I want to populate it by pulling the numeric values that are found in the first column of my filtered table.
I played around with table.column( 1 ).data() & table.row( 1 ).data() functionality but with no luck, I'm sure this is not difficult but I'm completely stumped on this. Any suggestions?
FYI - I'm using 1.10.2
This discussion has been closed.
Answers
OK so I was able to make some progress with this.
I started by just getting the list of all values in the columns.
This works fine but I want to generate a list of filtered data. I modified the code to use the oTable._ ('tr', {"filter":"applied"}); funtionality and it works! to an extend of what I want:
When I print the content of 'itemIds' I can see it has 4 entries instead of 6 so the filtering seems to work but the output values are blank. So it looks like my syntax is incorrect for pushing the value to the itemIds array. I've tried a few different ways to find the value but no luck.
Any suggestions on modifying the below syntax?
itemIds.push($(data[i]).find("td:eq(2)").text());
Maybe my answer helps you:
https://datatables.net/forums/discussion/comment/65480/#Comment_65480