Forum
04:14
21/08/2009
$.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);
}
}
};
09:44
Moderators
30/10/2007
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.
02:54
Moderators
30/10/2007
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.
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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66