Array of rows of visible columns
Array of rows of visible columns
MKPI
Posts: 3Questions: 2Answers: 0
Hi all,
I'm trying to extract an array of rows from my datatable. My problem is that I have some fields of the json that populates the table that I don't show in the table. When I use $('#myTable').DataTable().rows().data().toArray() I get those fields that I don't need.
¿How can I get that array of the shown fields or columns?
Thanks in advance.
This discussion has been closed.
Answers
You would need to use the
cells()
selector -cells( rowIdx, ':visible' )
(i.e. forrowIdx
get the visible cells.Do that inside a
rows().every()
function and add the results to an array (i.e. new array element for each row).Allan