skip to Main Content

I’m using the jQuery Datatables component and I need to retrieve the number of rows to display and the current page number.
Thanks.

2

Answers


  1. Chosen as BEST ANSWER

    I found the solution: to retrieve the current page number:

    var table = $(id_table).DataTable();
    var numPage= table.page();
    

    to go to a specific page:

    table.page(numPage).draw(false);
    

  2. datatable is very simple ,

    1. call jquery.dataTables.min.js and jquery.dataTables.min.css

    2. then datatable function in jquery call like below,

      $(document).ready(function () {
      $(‘#table_first_last_numbers’).DataTable({

       data: tableData,
       columns: columnData,
       pageLength: 4,
       pagingType: "first_last_numbers"
      

      });
      });

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search