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
multiple checkboxes per row
14/05/2010
01:39
Avatar
bkeszler
Member
Members
Forum Posts: 3
Member Since:
14/05/2010
sp_UserOfflineSmall Offline

I've done alot of searching around and I'm just not understanding how to set this up.  I must not be entering the right questions into Google.

What I want is a jqGrid with multiple checkboxes per row.  For discussion purposes, let's say it's a security admin tool with 9 columns.  Column 1 is the username and columns 2 through 9 are different security roles.  The colNames are 'Username', 'R1', 'R2', ... 'R8'.  Columns 2 through 9 simply have a checkbox indicating if that user has access to that role.  Clicking the checkbox will send an AJAX request to the server.

I've created the grid 2 different ways, but can't get either one working.  My most recent attempt has a custom formatter that sets up each of the checkboxes with an onclick event.

I can't seem to get the value of the checkbox, only the value that was originally loaded into the cell.  So if a checkbox was loaded as "true" and a check mark is shown, I always get the cell value of "true" even if the checkbox was just unchecked.

I also can't seem to determine which checkbox was clicked.  I can determine the row (and the unique username) but I can't determine which column the clicked checkbox is in.

Any help is appreciated.  I'm going to keep poking around on these forums and on the web.

17/05/2010
21:35
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

The problem is not related to jqGrid, but in a way how the "value" of checkbox is obtained.

$("#mycheckbox").val()  ===> alway true or somthing else

$("#mycheckbox").attr("checked") => Now this is your code to check whnever the value is checked or not. – it can be true or false depending on checking

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.

17/05/2010
23:15
Avatar
bkeszler
Member
Members
Forum Posts: 3
Member Since:
14/05/2010
sp_UserOfflineSmall Offline

Tony, I was just coming back to post my success story and I found your reply.  Thanks for the response!  I'm going to try your ideas to try and learn more about jQuery and jqGrid.

I finally got it working by using the setCell function to change the value in the cell.  My custom formatter creates an onclick event for the checkbox, which passes the rowid, column name, and current cell value to a function that handles the information however I need.

Works great!  If anyone would like to see the code, just let me know and I'll post it (after cleaning it up a bit).

02/07/2011
19:42
Avatar
kamp1234
New Member
Members
Forum Posts: 1
Member Since:
02/07/2011
sp_UserOfflineSmall Offline

bkeszler said:

Tony, I was just coming back to post my success story and I found your reply.  Thanks for the response!  I'm going to try your ideas to try and learn more about jQuery and jqGrid.

I finally got it working by using the setCell function to change the value in the cell.  My custom formatter creates an onclick event for the checkbox, which passes the rowid, column name, and current cell value to a function that handles the information however I need.

Works great!  If anyone would like to see the code, just let me know and I'll post it (after cleaning it up a bit).


Hello bkeszler,

i have same type of requiement . could you please me the code

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
61 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