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
Row revert issue with checkboxes (inline editing)
20/08/2009
13:49
Avatar
rickroot
New Member
Members
Forum Posts: 2
Member Since:
20/08/2009
sp_UserOfflineSmall Offline

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"

21/08/2009
03:51
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

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.

21/08/2009
05:20
Avatar
rickroot
New Member
Members
Forum Posts: 2
Member Since:
20/08/2009
sp_UserOfflineSmall Offline

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.

Forum Timezone: Europe/Sofia

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

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

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information