Pagination: .on("page" function(){}), and current list
Pagination: .on("page" function(){}), and current list
Is there a way to call the page method and have it see the target rows instead of the start rows? When I try to access the table from within the .on('page') callback function, e.g.
$(this).find('tbody tr').length
it's seeing the content in the first page (i.e. before I click Next), not the second page. Is there a way for the 'new' content to be visible inside the callback function?
Many thanks for a great plugin.
$(this).find('tbody tr').length
it's seeing the content in the first page (i.e. before I click Next), not the second page. Is there a way for the 'new' content to be visible inside the callback function?
Many thanks for a great plugin.
This discussion has been closed.
Replies
The `page` event is triggered before the new draw - it is is done when the data is changed internally, which is why you aren't yet seeing the new data. The new documentation for the event notes this: http://next.datatables.net/reference/event/page .
If you want to get the newly paged information you need to combine it with a draw event. You could do something like:
[code]
table.on( 'page', function () {
table.one( 'draw', function () {
...
} );
} );
[/code]
Regards,
Allan