How to get row data once I change the number of entries per page from the combo box ?

How to get row data once I change the number of entries per page from the combo box ?

mallikpk4umallikpk4u Posts: 14Questions: 5Answers: 0

Hi All,

Using the below code I can able to fetch the row data once I click on pagination button. Like the same way I need to get the data once I change the show entry from the top left combo box.

$('.paginate_button', this.api().table().container()).on('click', function(){
var data = table.rows({ page: 'current' }).data();
console.log(data)
});

For example, In the first case we are showing the 10 entries per page, then I'm going to change it to 25 entries per page. Here when I change the value from 10 to 25 I need to get the data of 25 rows.

Thank you.

Answers

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Hi @mallikpk4u ,

    Because you're listening for the click on the page button, it will still be the old size - you would be better using the DataTables events, such as length,

    Cheers,

    Colin

  • mallikpk4umallikpk4u Posts: 14Questions: 5Answers: 0

    That worked, Thanks a lot Colin :)

This discussion has been closed.