Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Small but useful little Features for jqGrid 3.8.1
03/12/2010
14:41
Avatar
Klaus
Member
Members
Forum Posts: 68
Member Since:
18/11/2009
sp_UserOfflineSmall Offline

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.

03/12/2010
14:45
Avatar
Klaus
Member
Members
Forum Posts: 68
Member Since:
18/11/2009
sp_UserOfflineSmall Offline

here is one more: ... to be able to pass the "modal"-option as option to the column chooser dialog ...

columnChooser : function(opts) {
            ...
            "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
                };
Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information