Topic: Datatable page number

vbdev premium asked 1 year ago

Hello, we are using the datatables with pagination for a variable amount of data. And we combine the pagination with an auto-refresh mechanism. When the user is going from one page to another, at each refresh the pagination is back to page 1. We need to get the page number to avoid this issue

Expected behavior : getting the page number in a variable and select page from js after fetch

Actual behavior : the variable is not available

Resources (screenshots, code snippets etc.)

Here is how we do it with datagrid :

table = $('#datagrid').DataTable({'displayStart': (this_size * this_page), 'pageLength': this_size, 'search': {'search': this_search}});
                        $('#datagrid').on('page.dt', function () {
                            var info =;
                            this_page =;

Kamila Pieńkowska staff answered 1 year ago

I've prepared snippet to show you how you can access info about active page.

In this example, I showed active page with console.log but you can use it however you need.

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Premium
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 3.8.0
  • Device: All
  • Browser: All
  • OS: All
  • Provided sample code: No
  • Provided link: No