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
Populating cell with dropdown select name
10/12/2009
03:13
Avatar
Hypex
Guest
Guests

Hi all,

I am trying to populate the listgrid cell, which has a value id currently, with the name of a dropdown list name. The dropdown list value should match the cell value then displaying the dropdown list name.

ColModel

{name:'event_city_id',event_city_id:'name',editable:true,edittype:"select",editoptions:{value:citySelect()}},

citySelect() function

function citySelect(){
             var citySelect = jQuery.ajax({
              url: "<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php?action=ajax_select_city",
              async: false
             }).responseText;
             return citySelect;
        }

citySelect() function return value

1:Australia-Melbourne;2:Australia-Sydney;3:Australia-Canberra;4:Australia-Brisbane

As you can see below event_id 19 shows the value 1. event_id 18 is what i would like it to show (Australia-Melbourne value = 1, same as the cell value). event_id 17 is just showing a list of names for the drop down.

[Image Can Not Be Found]

10/12/2009
05:33
Avatar
Hypex
Guest
Guests

[Solved]: had to add formatter:'select' to the field.

26/01/2010
01:47
Avatar
shah
Member
Members
Forum Posts: 26
Member Since:
30/12/2009
sp_UserOfflineSmall Offline

how do we get rid of the undefined in the dropdown. i am using a form not inline editing.

the data i am returning is

0:SELECT ONE;1:Value1;2:Value2;

The last semicolon is making the dropdown add undefined,

If i truncate the last semicolon then the dropdown adds a space character to the text in the last like

<select>


<option value='0'>SELECT ONE</option>
<option value='1'>Value1</option>

<option value='2'>Value2 </option>


</select>

Note the blank char after the Value2 for the last option tag.

Please advise. Confused

Shah

Her is my code http://pastie.org/794369

26/01/2010
18:27
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Since you do the string from ajax check your response from server. I think this ios the problem

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.

26/01/2010
18:42
Avatar
shah
Member
Members
Forum Posts: 26
Member Since:
30/12/2009
sp_UserOfflineSmall Offline

thanks tony for the quick response.

here is the response from the server as seen in firebug.

0:SELECT ONE;1:Value1;2:Value2

If i do a jquery trim on the response it works fine, not sure where the space is coming from.

28/01/2010
17:26
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Form here

"\\n"

(suppose you use PHP)

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.

28/01/2010
20:42
Avatar
shah
Member
Members
Forum Posts: 26
Member Since:
30/12/2009
sp_UserOfflineSmall Offline

That is a fantastic catch.. as on the java side i was doing a out.println and not out.print

thanks!

27/09/2013
12:44
Avatar
Vaishali09
New Member
Members
Forum Posts: 1
Member Since:
27/09/2013
sp_UserOfflineSmall Offline

Hi,

I have semicolon in my data itseif. Due to which dropdown that appears while editing contains undefined.

e.g,  1:AdamVanmeter;Developer;2:Kinaxis;3:Supply Chain

How can i solve this issue?

Please help.

Thanks,

Vaishali

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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