Button for next, previous, last, first, server-side??

Button for next, previous, last, first, server-side??

bloggusbloggus Posts: 6Questions: 0Answers: 0
edited May 2010 in General
Have been playing around a lot and think DataTables are just great.

Although maybe I'm missig something in the pagination.

Using: "sPaginationType": "full_numbers",

- When first page is showed I would like the "First", "Previous" buttons to be hidden
- When last page is showed I would like the "Last", "Next" buttons to be hidden

Is it possible and easy? Or not possible.

Replies

  • bloggusbloggus Posts: 6Questions: 0Answers: 0
    Nobody have a solution?
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    You could set the display option to 'none' for when there is a certain disabled class on the buttons (you can se the class using the class options: http://datatables.net/styling/custom_classes#sPageButtonStaticDisabled ). Or perhaps just the visibility or opacity.

    The other option would be to modify the pagination / create a pagination plug-in which performs exactly as you are looking for.

    Regards,
    Allan
  • bloggusbloggus Posts: 6Questions: 0Answers: 0
    Thanks. But when looking there I see that

    sPageButtonStaticDisabled and sPageButton have the same class "paginate_button".

    How can that be? Impossible to style then...
  • bloggusbloggus Posts: 6Questions: 0Answers: 0
    Ok, not I changes in the js file row 147

    From
    [code]"sPageButtonStaticDisabled": "paginate_button",[/code]

    To
    [code]"sPageButtonStaticDisabled": "paginate_disabled",[/code]

    And applied the class.

    I think this is a bug in the js files.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    You can change the default class names using the oClasses objects, and indicated in the previous link. It's up to you how the classes are defined if you don't want the defaults and can then style them at will :-)

    Regards,
    Allan
  • zack.panitzkezack.panitzke Posts: 1Questions: 0Answers: 0
    First, by way of introduction, I should say that this plugin is AMAZING. It saved me so much development effort over a couple of other solutions I'd been trying.

    I'm going to try the class definition fix suggested by allan. In the meantime, I'm curious.

    There seems to be the ability to enable/disable/hide the irrelevant pagination buttons (such as First/Previous on page 1) in the two-button pagination scheme, but the same classes don't exist for the full numbers pagination scheme. It seems like this functionality would be widely used enough such that the classes should be set by default, if not styled in any particular way. In fact, now that I look more closely, it seems like the jQuery UI classes draw a distinction between an activated and deactivated button as well...

    Perhaps I've missed something. Allan's solution does the trick, but why the disparity between the two built-in pagination schemes?
This discussion has been closed.