With DataTable I can order, list, do pagination but I want to detect when the pagination changes, I've seen the API but the only one I can do is change the page but no detect this change.
You may use fnDrawCallback or fnInfoCallback to detect changes, when next is clicked both of them are fired.
But beware, page changes are not the only source that can fire those callbacks.
The option is now drawCallback
Paging events are handled in this way,
$(document).ready(function() { $('#example') .on( 'order.dt', function () { console.log('Order' ); } ) .on( 'search.dt', function () {console.log('Search' ); } ) .on( 'page.dt', function () { console.log('Page' ); } ) .dataTable(); } );
documented in the official website, here http://www.datatables.net/examples/advanced_init/dt_events.html
The length.dt event is fired whenever the table's page length is changed
$('#example').dataTable(); $('#example').on( 'length.dt', function ( e, settings, len ) { console.log( 'New page length: '+len ); } );
http://datatables.net/reference/event/length
More events here
datatables.net/reference/event/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With