Increasing the Number of Pages

Increasing the Number of Pages

cworkmancworkman Posts: 10Questions: 4Answers: 0

Hello,

I'm trying to increase the number of pagination numbers from 5 to let's say 10-15.

I found an old post on this problem, but it doesn't seem to work. Could it be a change in the source code?

Here is the function that should increase my number of pages.

jQuery.fn.dataTableExt.oPagination.iFullNumbersShowPages = 10;

Any suggestions?

Thanks,
Channing

This question has an accepted answers - jump to answer

Answers

  • ignignoktignignokt Posts: 146Questions: 4Answers: 39

    The only answer that I can find that somewhat works is: $.fn.DataTable.ext.pager.numbers_length = 10;

    However, when I do this it only works when I am at the beginning or end of my pagination. When on page 1-6 I see Previous 1 2 3 4 5 6 7 8 ... 163 Next. When I reach page 7 I see Previous 1 ... 6 7 8 ... 163 Next. This is the exact same thing I see if I set the length to 5, 10, 20, etc. The only difference is the page number this starts happening on. So it seems like at some point it ignores this setting when you are X pages away from the start or end point.

    I'm sure @allan could give some more insight on this. It sort of seems like a bug to me but usually when I think that I have encountered one using dataTables I am just doing something wrong. ;-)

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Answer ✓

    It needs to be an odd number of the internal mathematics to work. It needs to be better documented that parameter! It also can't be less than 5 at the moment.

    Allan

  • ignignoktignignokt Posts: 146Questions: 4Answers: 39

    When I change it from a 10 to a 9: $.fn.DataTable.ext.pager.numbers_length = 9; I still have the same issues I listed above. Is that what you meant when you said it needs to be an odd number? I am doing this before the DataTables initializes, and it is using server-side data.

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Urgh - yes. I see exactly the same problem with a little test case here: http://live.datatables.net/biyoqesi/1/edit . A bug for certain... I'll try to look into it soon.

    Allan

  • cworkmancworkman Posts: 10Questions: 4Answers: 0

    Thank you!

  • cworkmancworkman Posts: 10Questions: 4Answers: 0

    Allan,

    I'm also experienced the bug ignignokt is experiencing. Have you had any luck with fixing the bug?

    Thanks,
    Channing

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    I've not had time to look into it yet. Up to my eyeballs at the moment!

    Allan

This discussion has been closed.