Forum


So I'm using this jquerygrid plugin () and it's working pretty well. I'm trying to use the inline edit feature to edit a couple fields in the row using checkboxes... the values in the DB are 1 and 0.
So in my colModel, I have this:
{name:'ISOWNER',index:'ISOWNER', width:50, editable:true, edittype:"checkbox", editoptions: {value:"1:0"}},
{name:'SENDALERT',index:'SENDALERT', width:50, editable:true, edittype:"checkbox", editoptions: {value:"1:0"}},
It works great. Most importantly, if I uncheck something, then go to another row, the original value of the checkbox is restored (because I didn't save). So if it was a 1, and I unchecked it, then went to another row, it would revert to a 1 - as it should.
But If I change it to this:
{name:'ISOWNER',index:'ISOWNER', width:50, editable:true, formatter:yesNoFormatter, edittype:"checkbox", editoptions: {value:"Yes:No"}},
{name:'SENDALERT',index:'SENDALERT', width:50, editable:true, formatter:yesNoFormatter, edittype:"checkbox", editoptions: {value:"Yes:No"}},
the checkboxes LOAD properly, but the restore of the row fails and the values are always reverted to "No"
03:51

Moderators
30/10/2007

Hello,
What do yesNoFormatter?
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.
I figured out that my formatter was causing the problem... I was only formatting for 0 and 1 values, but apparently i needed to also deal with the possible values of the checkbox as well, which were "Yes:No"
So I changed my formatter to be like this (this is pseudocode, I don't have the exact formatter in front of me right now)
if (val == '1' || val == 'Yes' ) { return 'Yes'; } else { return 'No'; }
and now it works.
Most Users Ever Online: 715
Currently Online:
41 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