Forum


00:21

08/01/2010

a field with 3 possible values : 0,1,2
a colModel for this field :
{name:'ADHERENTS',index:'ADHERENTS', width:colwidthBOOL, align:"center", sortable:false, formatter: adherentsFmatter, editable:true, edittype:'select', editoptions: {value: adher_editSelOpts}, editrules:{}, searchoptions:{sopt:['eq'], dataInit:function(elem) { $(elem).val('0');}}},
a editoptions => adher_editSelOpts :
var adher_editSelOpts = { 0 :"Non autorisé", 1: "En consultation", 2: "En modification" };
formatter and unformatters :
function adherentsFmatter(cellvalue, options, rowObject){
switch (cellvalue) {
case '0': html=''; break;
case '1': html='<span class="icon-redmond-document"></span>'; break;
case '2': html='<span class="icon-redmond-edit"></span>'; break;
default: html='';
}
return html;
}
function adherentsUNFmatter(cellvalue, options, cellobject){
var spanClass= jQuery(cellobject).children().eq(0).attr("class");
switch (spanClass) {
case 'icon-redmond-document': val=1; break;
case 'icon-redmond-edit': val=2; break;
default: val=0;
}
return val;
}
the formatter is OK in listmode and in viewmode;
in edit mode, the select tag is wrong against the value;
I think the unformatter function is no good; it's difficult to know where the unformatter do his work;
Thank you for any help.
Olivier.
18:05

Moderators
30/10/2007

Hello,
The job of the unformatter can be set in colModel, which you missed this.
http://www.trirand.com/jqgridw....._formatter
{name:'ADHERENTS',index:'ADHERENTS', width:colwidthBOOL, align:”center”, sortable:false, formatter: adherentsFmatter, unformat: adherentsUNFmatter, editable:true, edittype:'select', editoptions: {value: adher_editSelOpts}, editrules:{}, searchoptions:{sopt:['eq'], dataInit:function(elem) { $(elem).val('0');}}},
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:
58 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