Forum
14:41
18/11/2009
Hello Tony,
here are 2 little features (incl. Source for simple insert) I would like to have in jqGrid:
Feature 1) additional callback for AJAX requests done by grid: ajaxComplete
... to be able to do some custom code (e.g. for custom instrumentation/ speed measurements) directly at AJAX function success callback is called:
var p = $.extend(true,{
...
ajaxComplete: null, // added callback to global options (default null)
...
populate = function (npage) {
...
case "script":
$.ajax($.extend({
url:ts.p.url,
type:ts.p.mtype,
dataType: dt ,
data: $.isFunction(ts.p.serializeGridData)? ts.p.serializeGridData.call(ts,ts.p.postData) : ts.p.postData,
success:function(data,st) {
if($.isFunction(ts.p.ajaxComplete)) { ts.p.ajaxComplete.call(ts,data,st); } // invoke callback in AJAX success function (at the top)
if(dt === "xml") { addXmlData(data,ts.grid.bDiv,rcnt,npage>1,adjust); }
...
Feature 2) additional option for the "loadui"-loading indicator ("delay")
I'm using automatic updates for my grid reloading the data every x seconds from the server. 90% of the requests are really fast so I don't want to show a loading-indicator which will be displayed so short that's only flickering, but in the other 10% of the table reloads the user should be notified that the reload might take longer ... display loading.
So I implemented another option for the "loadui" setting ... "delay" which shows the loading-indicator not before a defined delay of e.g. 500msec ... maybe this value should be also defined as global option.
/* add global "delay" loading function to show loading indicator not immediately but after a short delay */
lateShowLoading: function() {
if (grid.loadingTimer) { clearTimeout(grid.loadingTimer); }
grid.loadingTimer = null;
$("#load_"+ts.p.id).show();
},
beginReq = function() {
ts.grid.hDiv.loading = true;
if(ts.p.hiddengrid) { return;}
switch(ts.p.loadui) {
case "disable":
break;
case "enable":
$("#load_"+ts.p.id).show();
break;
case "delay": /* added "delay" loading indicator option */
grid.loadingTimer = setTimeout(grid.lateShowLoading, 500);
break;
case "block":
$("#lui_"+ts.p.id).show();
$("#load_"+ts.p.id).show();
break;
}
},
endReq = function() {
ts.grid.hDiv.loading = false;
switch(ts.p.loadui) {
case "disable":
break;
case "enable":
$("#load_"+ts.p.id).hide();
break;
case "delay": /* added "delay" loading indicator option */
if (grid.loadingTimer) {
clearTimeout(grid.loadingTimer);
grid.loadingTimer = null;
}
$("#load_"+ts.p.id).hide();
break;
case "block":
$("#lui_"+ts.p.id).hide();
$("#load_"+ts.p.id).hide();
break;
}
},
Maybe you could integrate these features into the next jqGrid version.
Kind regards,
Klaus.
14:45
18/11/2009
here is one more: ... to be able to pass the "modal"-option as option to the column chooser dialog ...
...
"dlog_opts" : function(opts) {
var buttons = {};
buttons[opts.bSubmit] = function() {
opts.apply_perm();
opts.cleanup(false);
};
buttons[opts.bCancel] = function() {
opts.cleanup(true);
};
return {
"buttons": buttons,
"close": function() {
opts.cleanup(true);
},
"modal" : opts.modal, // CHANGED: pass along the modal option
"resizable": false,
"width": opts.width+20
};
Most Users Ever Online: 715
Currently Online:
40 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66