How to search and get item count?
How to search and get item count?
Z06Monster
Posts: 3Questions: 0Answers: 0
I was wondering if there is a function to search and get item count for a column?
Say for example it displays 5 items per page
Col1 Col2 Col3
Honda Dog Apple
Toyota Cat Orange
BMW Cow Cherry
Ford Snake Grape
Honda Dog Durian
Hyundai Dog Mango
With datatable, the 2nd page will with the 6th row will not be shown on the page. Say for example, I want to get the count of how many items contain "Dog" in Col2. I can do this in jQuery, but the result will be "2", not "3" because the 2nd page is hidden. I tried using fnGetData, but that shows all of the data, including the non filtered ones. Does datatable store the filtered data somewhere or is it on the fly (Uses the unsorted data and then filters as one clicks on next, prev, etc)?
Any help would be appreciated!
Say for example it displays 5 items per page
Col1 Col2 Col3
Honda Dog Apple
Toyota Cat Orange
BMW Cow Cherry
Ford Snake Grape
Honda Dog Durian
Hyundai Dog Mango
With datatable, the 2nd page will with the 6th row will not be shown on the page. Say for example, I want to get the count of how many items contain "Dog" in Col2. I can do this in jQuery, but the result will be "2", not "3" because the 2nd page is hidden. I tried using fnGetData, but that shows all of the data, including the non filtered ones. Does datatable store the filtered data somewhere or is it on the fly (Uses the unsorted data and then filters as one clicks on next, prev, etc)?
Any help would be appreciated!
This discussion has been closed.
Replies
If you're using client side processing, all the data is found in oTable.fnSettings().aoData:
row i's data is an in array at oTable.fnSettings().aoData[i]._aData. you can loop over this.