2

how can i get the action (what button was clicked) when a button is clicked in the pager?(edit, del, add...)

leppie
  • 115,091
  • 17
  • 196
  • 297

3 Answers3

2

You probably means button of the navigation bar or navigator (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:navigator).

You can implement what you want with at least three different ways:

  1. You define your custom buttons which look like the original add/edit/del buttons (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:custom_buttons) and use {add:false, edit: false, del: off} parameter of navGrid to switch off standard buttons.
  2. You can use addfunc, editfunc and delfunc if you want replace the default add/edit/del functions.
  3. You can use onclickSubmit or afterSubmit or some another supported events (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:form_editing#events) of add/edit/del button to do some additional action on click the buttont or on submit.

You can chose the way which is the best for your requirements.

Oleg
  • 220,925
  • 34
  • 403
  • 798
1

You can use the grid onPaging event:

This event fires after click on [page button] and before populating the data. Also works when the user enters a new page number in the page input box (and presses [Enter]) and when the number of requested records is changed via the select box. To this event we pass only one parameter pgButton (string) which can be - first,last,prev,next in case of button click, records in case when a number of requested rows is changed and user when the user change the number of the requested page.requested page.

Marcus Leon
  • 55,199
  • 118
  • 297
  • 429
0

Also there are beforeRequest and LoadComplete events. Examples that worked for me are as follows:

beforeRequest: function () {
                        $.blockUI();
                        //alert("before request");
                    },

                    loadComplete: function () {
                        //alert("load complete");

                        $.unblockUI();
                    }
kulNinja
  • 526
  • 6
  • 14