Leave paging fixed using jQuery datatable

Asked

Viewed 637 times

0

I have a table and I’m using it datatable of jQuery, however, my table has a lot of column, and I did a scroll on it, but in this my paging scrolls along with the scroll, would have some way to leave the pagination fixed?

EXAMPLE HERE

thank you.

3 answers

1


To leave the pagination above the table, just use the option sDOM API itself to rule that paging will be above. This way:

$(document).ready(function(){
    $('#myTable').DataTable(
      {
        "sDom": '<"top"p>'
      }
    );
});

Otherwise, you stylize the way you want.

  • "top" is not a class or id, is a property, so it has no effect. In this example, you can see how the sDOM.

  • Buddy, see perfectly in the example: http://jsfiddle.net/iguimaraes/un6aw4at/

  • The scroll continues to move pagination.

0

For this, just define from the own plugin, using the option scoolX, see:

$(document).ready(function(){
    $('#myTable').DataTable({
      'scrollX' : true
    });
});

For more information about the functionalities plugin make available just follow the references.

References:

Basic initialisation - Datatables

Scroll - horizontal

0

Hello, just add settings by CSS as follows:

#myTable_paginate {
    float:left !important;
}

You can put other settings like padding and margin for example, to adjust better

  • tipow, would it be possible to leave the paging out of the scroll? for it to be fixed

  • That’s up to position: fixed; left:0px; top: 0px; where you will position the left and top to put the div where you want. But so we need to put somewhere that will not be subject to changes by variable data, as in the footer of the table. On the top would be safer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.