Notify page number. jQuery dataTables page change event

The following works for me:

$('#datatable').on('page.dt', function() { alert("changed"); }); 

Whenever I change the page, a warning appears. But if I want to warn the page is not. which is clicked then that way

+6
source share
1 answer

table.page.info() returns the current pagination information. This is the current page , the number of pages , recordsDisplay , recordsTotal , etc.

 var table = $('#datatable').DataTable(); $('#datatable').on('page.dt', function() { var info = table.page.info(); var page = info.page+1; alert('changed - page '+page+' out of '+info.pages+' is clicked'); }); 

see demo -> http://jsfiddle.net/qpLtLfaz/

+8
source

Source: https://habr.com/ru/post/973811/


All Articles