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
Getting the value when using edittype: "select"
19/02/2009
02:11
Avatar
james_
Member
Members
Forum Posts: 27
Member Since:
16/02/2009
sp_UserOfflineSmall Offline

Hey! 🙂

I have a column with edittype:"select", formatter:"select" and editoptions:{value1:name1;value2:name2}

This works in the grid itself, but I can't seem to get value1 and value2. When I do $("#container").getDataIDs(); and loop them I get the row with row=$("#container").getRowData(loop_counter);, and I get the select's "name1" and "name2" data using row.colName

Since row.colName gives me name1 and name2, how do I get value1 and value2?

Not quite sure if I need the formatter? Neither solves my issue I think. I've searched the documentation without finding anything..

19/02/2009
10:54
Avatar
cartman
Member
Members
Forum Posts: 18
Member Since:
14/02/2009
sp_UserOfflineSmall Offline

I asked that question here:

http://www.trirand.com/blog/?p.....air/page-1

I haven't heard back from Tony on how to do this.

In the meant time I may resort to using the standard jquery functionality of grabbing the value using the val() function if there isn't one built into jqGrid. I think the name of the cell id for that row is "rowid_cellname" but haven't verified that yet with FireBug.

That would be my advice until we hear back if there is another way.

19/02/2009
14:24
Avatar
james_
Member
Members
Forum Posts: 27
Member Since:
16/02/2009
sp_UserOfflineSmall Offline

I've looked a bit at it, but getRowData() returns the content of each cell, which is a normal table. The content is not the select-element which only shows when you edit the cell. Actually, if the cell is being edited as you fetch its value, you'll get the HTML for the select-element, but still you don't know which one is selected of course. Not that it's an option that have all such cells being edited as you fetch their values 🙂

I'm not sure what to do, but since the items I have there are unique, I will simply send the value and find it's ID before saving it, and simply avoid the issue for now. Let me know if you find a solution to it! I'm saving my grid this way instead of going by a form. Perhaps that's where the mistake is?

20/02/2009
09:13
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Since this is many time discussed and there seems really to be aproblem with this - here some explanation. Suppose we have

value: {'key1:value1;key2:value2'}

(note that since 3.4 this can be a editoptions:{value:{key1:'value1',key2:'value2'}}

Note the json representation

1. If we are in edit mode (formedit, inlineedit cell edit) and have a select control, the true “value” that is posted to the server is the key value and not the value, but after saving we display the value. If you do not have any spacial calculations in this case is nothing to do.

2. The problem that I do not understand is when you need the key value? During wich proccess or user interaction?

3. The most common error here is that you think OK during editing I will use getRowData method to do something. This is explained so many time here. This is bad. You will receive in this case the html input control.

4. I recommend to use your own methods to get the value of this control during editing. How to do that? I think it is easy. Every control when we are in edit mode has a uniquie id which is combination of the following:

For Inline edit : rowid+”_”+name - where name is name from colModel, and rowid is the current edited row with id = rowid

For Cell editing : iRow+”_”+name where name is name from colModel and iRow is the index of the row (not rowid).

For Form edit: name - where name is the name form colModel

I hope that this will help a little.

Best 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/02/2009
06:13
Avatar
james_
Member
Members
Forum Posts: 27
Member Since:
16/02/2009
sp_UserOfflineSmall Offline

Thanks  Tony!

What about when I use GridToTable? The name is sent there as well, I obviously want to save the value and not the name..

24/02/2009
07:47
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

This is user contributed module. This module can be extended, so that it accept grid parameters, passed to the function.  If you look deeper in the code you can do it easy. Will be happy with this

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:
22 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