Show paging arrows only when needed

Show paging arrows only when needed

justStevejustSteve Posts: 49Questions: 8Answers: 1
edited December 2009 in General
Any built-in setting (or plug'nplay javascript) to hide the '< >' icons unless a resultset actually spans more than the current page?

[I suppose I could replace the back/forward_disabled.jpgs with blank images]

thx

Replies

  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin
    Hi justSteve,

    The images for the two button pagination are provided by CSS, So for the two classes "paginate_disabled_previous" and "paginate_disabled_next" you could just remove the background image attribute. Either that or replace them with a transparent gif as you suggest.

    Regards,
    Allan
  • urosbeurosbe Posts: 2Questions: 0Answers: 0
    Hi Allan,

    is it also possible to hide numeric paging controls if they are not needed (in case result set is within single page)? It would be also nice to remove "first/previous" if you are positioned on first page or remove "next/last" if you are on the last page.

    Best regards,
    Uros
  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin
    Yes - there are two options for that. Firstly you can have an fnDrawCallback function which will use display:none/block on the pagination element when there is only one page's worth of data to display (oSettings.fnDisplayEnd()), or you can have a custom pagination plug-in ( http://datatables.net/development/pagination ) which will contain the logic required for the show / hide.

    Allan
This discussion has been closed.