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
Dropdowns bind to a "text" value instead of a key value....
04/08/2008
20:50
Avatar
Jon
Member
Members
Forum Posts: 6
Member Since:
04/08/2008
sp_UserOfflineSmall Offline

.... but post to the server as a key value.

Hi All,

When binding to a dropdown list my data has to contain the text of the dropdown versus the value of the dropdown.  When the form posts back to the server it contains the value not the text.  Anyway dropdowns can bind to the value instead of the text?  or at least have a switch?  I understand wanting both but the current implmentation mixes them together.

(Again I am total n00be!)

TIA

-Jon

We dont callit Eaves dropping we call it freedom listening.......

05/08/2008
01:42
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Jon,

What about keyvalue = text - I mean you can construct the dropdown to have the same values of key and text - If I understand right.

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.

06/08/2008
19:18
Avatar
Jon
Member
Members
Forum Posts: 6
Member Since:
04/08/2008
sp_UserOfflineSmall Offline

Hi Tony. When I supply the JSON data to the grid I send the dropdown text.  When the user saves (I am using formedit -nice job BTW!) the value is sent back.  It would be desirbale to not send the text but instead send teh value and have the form combo box bind to the value instead of the text.  Hopefully that makes sense.

TIA

-Jon

tony said:

Jon,

What about keyvalue = text - I mean you can construct the dropdown to have the same values of key and text - If I understand right.

Regards

Tony


We dont callit Eaves dropping we call it freedom listening.......

07/08/2008
02:55
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hi Jon,

I think that I do not undertstand something. So let me explain what I know.

To the grid you send the text of the combo - right?

You use formedit to change the values of that field.

But before doing this jqGrid should know what for values and text are

for this combo - right? This is done via editoptions:{value:"key1:value1;...

In other words you should construct editoptions value. This can be

done statically and dynamically depending on your needs - or simply

we should have the key before they is sended to the server.

My question is where are the keys for these combos?

Best

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.

07/08/2008
05:15
Avatar
daniel.pool
daniel.pool
Member
Members
Forum Posts: 5
Member Since:
01/08/2008
sp_UserOfflineSmall Offline

Hello,

Sorry to butt in on a post, but I was about to request the same feature. My drop down lists uses the database ID of a field for the select's value and a text field as it's text. The fact that jGrid returns the value is great as I can simply put the ID into the referencing object. However, I'm having to fudge some nasty look up code (a problem with my companies framework) in order to provide the text value in the cell to resolve the drop down. It would be much easier for me to be able to use the ID and have the drop down resolve using that.

Regards,

~Dan

P.S. Your suggest to use the text and the value element of the select is not really feasible as some of the names can be very long and are not guaranteed to be unique.

07/08/2008
05:27
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

This is true only if the values in editoptions are static. In case of dynamic values in options this will not work since the engine will read the data, but the text are not redy yet.

Instead I will try to investigate this

Thank you

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.

07/08/2008
10:27
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Ok,

When the values are static here is a fragment on how to do that:

afterInsertRow : function(rowid,recdata){

var idtotext;

colid = 2; //the id of the column which holds the select begin from 0

switch (recdata.selectid){

case 'AB':

idtotext = 'ABTEXT';

break;

….

}

$(”#mygrid”).SetCell(rowid,colid,idtotext);

// when we use colid instead of colname this method is faster

}

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