Issue with reading all values of a column when pagination is true

Issue with reading all values of a column when pagination is true

ayushsa01ayushsa01 Posts: 3Questions: 1Answers: 0
edited October 2018 in Free community support

When pagination is true I am able to read only 10 values, it doesn't read values on next pages (2,3,4,5,...)

var ColumnIndex = 25;
$('#example tr').each(function () {
                    var Column= $(this).closest('tr').find('td:eq('+ ColumnIndex +')');
                    var ColumnValue = Column[0].innerText;
                    alert(ColumnValue );
});

This question has accepted answers - jump to:

Answers

  • colincolin Posts: 15,171Questions: 1Answers: 2,589
    Answer ✓

    Hi @ayushsa01 ,

    Yep, that's because your code is reading it directly from the table visible on the screen. If you use the API call, column().data(), you'll get access to all the data on all pages for that column.

    Cheers,

    Colin

  • ayushsa01ayushsa01 Posts: 3Questions: 1Answers: 0

    How do I store them in a array.?

  • colincolin Posts: 15,171Questions: 1Answers: 2,589
    Answer ✓

    You can use toArray(), so something like

    $('#example').DataTable().column(25).data().toArray();
    

    Cheers,

    Colin

  • ayushsa01ayushsa01 Posts: 3Questions: 1Answers: 0

    How to get the header value of that same column.?

  • colincolin Posts: 15,171Questions: 1Answers: 2,589
This discussion has been closed.