user2675939
user2675939

Reputation: 371

jQuery Datatables show page numbers at top

I am using jQuery Datatables with pagination numbers at the bottom of the table. However, I would like to move it to the top since when the page numbers are changes, because of the amount of data (also iDisplayLength set as 100), user requires to scroll at the top everytime, which is annoying.

Here is my code:

     $(function() 
     {
      oTable = $('#example').dataTable({
        "bJQueryUI": true,
        "sPaginationType": "full_numbers",
        "iDisplayLength": 100,
        "sDom": '<"top"<"actions">fpi<"clear">><"clear">rt<"bottom">',
    });
});

This seems to work, but it removes my 'Show entries' drow-down, where I give an option for someone to select number of entries to show on page and also removes my styles.

Upvotes: 4

Views: 9113

Answers (1)

Gyrocode.com
Gyrocode.com

Reputation: 58890

As pointed out by @azeos, you are missing l in sDom. Corrected code is shown below:

$(function(){
   var oTable = $('#example').dataTable({
       "bJQueryUI": true,
       "sPaginationType": "full_numbers",
       "iDisplayLength": 100,
       "sDom": '<"top"<"actions">lfpi<"clear">><"clear">rt<"bottom">'
   });
});

See sDom (DataTables 1.9) or dom (DataTables 1.10+) for more information.

Upvotes: 4

Related Questions