2

I have a jqgrid with pager buttons that I want to customize and I would like to keep the buttons (next, forward, first and last) from being disabled once the grid is binded (if my initial query only fills one page, the buttons get disabled). I have tried the following after reloadGrid but it's not working.

    $("#MyGrid pgbuttons").removeClass("ui-state-disabled") 

Any help is appreciated!

orikon
  • 293
  • 2
  • 8
  • 18
  • Could you describe more about your environment and *why* you need so strange requirement? Why you need have "Next" button enabled if you know that no next page exist? Enabling of the button is like the sign on the closed door "Please, come in". It's just an invitation to make an error. I suppose you have some special situation which you not described in your question. Please expend your question to describe the sense of your requirements. – Oleg Nov 09 '11 at 09:46
  • My paging is being done server-side. It takes a long time to retrieve all of the data at once so I am requesting 20 items at a time. When I click on the pager, it would retrieve the next 20 and so on. But I can't do that because the button gets disabled as soon as I get my first 20 items, which indeed only fills one page. Please let me know if there is a better way to do this – orikon Nov 10 '11 at 18:07

1 Answers1

2

If you need to have the "Next" and the "Last" buttons of the pager enabled just because you don't know the number of records and the number of pages which you has you can do following:

  • place in the server response the total value at least one higher as the current requested page. For example: "page":1, "total":2.
  • modify pgtext and recordtext options of jqGrid (see the documentation). For example pgtext : "Page {0} of ..." and recordtext: "View {0} - {1} of ..." or just pgtext : "Page {0}" and recordtext: "View {0} - {1}"
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Why are the pager `next` buttons enabled initially? http://stackoverflow.com/questions/34286651/why-are-next-pager-buttons-enabled-initially – Suhail Gupta Dec 15 '15 at 10:45