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
fix for formatter multiple select @jquery.fmatter.js
25/08/2009
04:14
Avatar
dhubenov
Stara Zagora, Bulgaria
Member
Members
Forum Posts: 8
Member Since:
21/08/2009
sp_UserOfflineSmall Offline

    $.fn.fmatter.select = function (cellval,opts, act) {
    // jqGrid specific
    if(act=='edit') {
      return $.fn.fmatter.defaultFormat(cellval, opts);
    } else {
      if (!isEmpty(cellval)) {
        var oSelect = false;
        if(!isUndefined(opts.colModel.editoptions)){
          oSelect= opts.colModel.editoptions.value;
        }
        if (oSelect) {
          var ret = [],
          msl =  opts.colModel.editoptions.multiple === true ? true : false,
          scell = [], sv;
          if(msl) { scell = cellval.split(","); scell = $.map(scell,function(n){return $.trim(n);})}
          if (isString(oSelect)) {
            // mybe here we can use some caching with care ????
            var so = oSelect.split(";"), j=0;
            for(var i=0; i<so.length;i++){
              sv = so[i].split(":");
              if(msl) {
                if(jQuery.inArray(sv[0],scell)>-1) {
                  ret[j] = sv[1];
                  j++;
                }
              } else if($.trim(sv[0])==$.trim(cellval)) {
                ret[0] = sv[1];
                break;
              }
            }
          } else if(isObject(oSelect)) {
            // this is quicker
            if(msl) {
              ret = jQuery.map(scell, function(n, i) { // <-- misspelled var name
                return oSelect[n];
              });
            } else { // if not in else clause it will remove the first of multiple values
              ret[0] = oSelect[cellval] || "";
            }
          }
          return ret.join(", ");
        } else {
          return $.fn.fmatter.defaultFormat(cellval, opts);
        }
      } else { // we don't like to see 'undefined' if there is nothing selected
        return $.fn.fmatter.defaultFormat(cellval, opts);
      }

    }
  };

30/08/2009
09:44
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Thank you very much for this. Fixed – little changes on this, since the action edit is not needed anymore

Best Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

03/09/2009
07:51
Avatar
Martin
Guest
Guests

Is this in GitHib yet?  Thx

Martin

04/09/2009
02:54
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Yes - it is in GitHub.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
84 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