How to get cell data from selected columns with a paginated page and colreorder.

How to get cell data from selected columns with a paginated page and colreorder.

greenman123greenman123 Posts: 10Questions: 5Answers: 0

I need to build an array of 'types' in jQuery.

The types I need to populated the array are included in a datatable column, I only want to add the selected row's 'types' to the array.

If this wasn't a paginated page I could loop through all the table rows with .selected class, however, because it is this will only get the selected rows for the page you are on, missing the rest on the other pages.

I can't use table.rows( '.selected' ) because this means I need to get the data by array index, but as I am also using colReorder, this index moves around.

I can't add and remove to the array as and when the .tr is clicked because multiple rows can be deselected in one tr click.

Maybe the only way to do it is by including the type column as a non-reorderable column? But is there any other way to achieve this?

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 5,549Questions: 0Answers: 970
    edited January 16 Answer ✓

    Hi @greenman123 ,

    If this wasn't a paginated page I could loop through all the table rows with .selected class, however, because it is this will only get the selected rows for the page you are on, missing the rest on the other pages.

    You can get all the rows on all page by using rows() and passing in the selector-modifier of page: 'all',

    Cheers,

    Colin

  • greenman123greenman123 Posts: 10Questions: 5Answers: 0

    Ahh, thanks very much!

Sign In or Register to comment.