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
formatter and select tag in editGridRow
11/01/2010
00:21
Avatar
olaf
GRENOBLE (FRANCE)
Member
Members
Forum Posts: 27
Member Since:
08/01/2010
sp_UserOfflineSmall Offline

 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.

13/01/2010
18:05
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

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.

Forum Timezone: Europe/Sofia

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

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

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information