Permalink
Browse files

Better control when using loadBefreSend. Now the request can be cance…

…led if the event return false.

This is due the beforeSend jQuery function.
  • Loading branch information...
tonytomov committed Sep 22, 2011
1 parent 38f0071 commit 9899c80a16623285c483e87bfc8f8bb1004ae3ac
Showing with 11 additions and 3 deletions.
  1. +11 −3 js/grid.base.js
View
@@ -1705,9 +1705,17 @@ $.fn.jqGrid = function( pin ) {
if (npage === 1) { endReq(); }
xhr=null;
},
- beforeSend: function(xhr){
- beginReq();
- if($.isFunction(ts.p.loadBeforeSend)) { ts.p.loadBeforeSend.call(ts,xhr); }
+ beforeSend: function(xhr, settings ){
+ var gotoreq = true;
+ if($.isFunction(ts.p.loadBeforeSend)) {
+ gotoreq = ts.p.loadBeforeSend.call(ts,xhr, settings);
+ }
+ if(gotoreq === undefined) { gotoreq = true; }
+ if(gotoreq === false) {
+ return false;
+ } else {
+ beginReq();
+ }
}
},$.jgrid.ajaxOptions, ts.p.ajaxGridOptions));
break;

0 comments on commit 9899c80

Please sign in to comment.