Editing Pagination button size

Editing Pagination button size

D19cannonD19cannon Posts: 15Questions: 3Answers: 0

Hi guy! I have been searching for an option that defines how many buttons you have in the pagination.
My current situation looks as follow:

And I wish to remove page 4 and 5 for instance.
Tabulator plugin had a solution that was:
$("#example-table").tabulator({
paginationButtonCount:7,
});

Is there similar solution for datatables?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,434Questions: 1Answers: 10,458 Site admin

    Yes, but its currently not documented:

    $.fn.DataTable.ext.pager.numbers_length
    

    Is the source.

    Allan

  • D19cannonD19cannon Posts: 15Questions: 3Answers: 0

    Hi Allan! Thanks for the quick response. I see your solution, however, I do not understand how to apply it? Is there a setting option or anything, something like this: ?

  • allanallan Posts: 63,434Questions: 1Answers: 10,458 Site admin

    You would set that parameter before initialising the DataTable as its a static parameter:

    $.fn.DataTable.ext.pager.number_length = 5;
    $('#sensor_table').DataTable({
      ...
    });
    

    Allan

  • D19cannonD19cannon Posts: 15Questions: 3Answers: 0

    I tried to do it the way you suggested. Unfortunately, without luck so i tried a few different ways. Calling before the table is called, when the DOM is initialised, but that didn't work either.

    Any other suggestions?

    Daniel

  • D19cannonD19cannon Posts: 15Questions: 3Answers: 0

    Update: I can see something is happening, because when change 'pager' into 'page' it won't load my page any more. So, is there a function which is maybe similar to that one?

  • allanallan Posts: 63,434Questions: 1Answers: 10,458 Site admin
    Answer ✓

    Ooops - its numbers_length! http://live.datatables.net/dotoyico/1/edit

    Allan

  • D19cannonD19cannon Posts: 15Questions: 3Answers: 0

    Great it worked! Thank you very much Allan, it's appreciated :)

This discussion has been closed.