Array of rows of visible columns

Array of rows of visible columns

MKPIMKPI 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.

Answers

  • allanallan Posts: 63,538Questions: 1Answers: 10,476 Site admin

    You would need to use the cells() selector - cells( rowIdx, ':visible' ) (i.e. for rowIdx 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

This discussion has been closed.