Using jQuery selector to get every row in datatable?
Using jQuery selector to get every row in datatable?
If the last cell of every row in my table has the same class attribute (ex. <td class="myClass" >), and I try to select all of these cells using the jQuery selector $('.myClass'), the resulting array only contains the cells that are currently being displayed on the page, leaving out the ones that exist on other pages of the datatable.
Is there a way to make it so that this selector will return every element in the table, not just the elements on the current page of the table? If not, what would be the best way to accomplish the same task in a different manner.
Thanks.
Replies
As DataTables removes nodes form the document that aren't needed for display, you would need to use the DataTables API.
Specifically you could use the
cells().nodes()
method orcolumn().nodes()
(which would be faster if you know which column is being used):will give you a jQuery object with the cells from the last column in the table.
Allan