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
Dynamically Populate Select Dropdown
10/09/2010
15:49
Avatar
donnazhen
Member
Members
Forum Posts: 5
Member Since:
10/09/2010
sp_UserOfflineSmall Offline

I saw the Dynamically Populate Select Dropdown topic in this forum and my project is working fine when adding a new record in form editing, there's no problem. I'm wondering how can I get the value of first dropdown to pass as parameter(initialid) in the dataUrl of second dropdown box when editing rocords?

 colModel:[

...

{name:'select_one',

editable: true,

edittype:"select",

editoptions: {

dataUrl:'test_one.php',

dataEvents :[

{ type: 'change', fn: function(e) {

var thisval = $(e.target).val();

$.get('test_two.php?myid='+thisval, function(data)

{ var res = $(data).html();

$("#select_two").html(res);

}); // end get

}//end func

} // end type

] // dataevents

} // edit option

},
{name:'select_two',editable: true,edittype:"select", editoptions:{dataUrl:'test_two.php?myid=initialid'}}       


],

Thank you in advanced.

10/09/2010
19:19
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Please look here:

http://www.trirand.com/blog/?p.....38;ret=all

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.

10/09/2010
23:13
Avatar
donnazhen
Member
Members
Forum Posts: 5
Member Since:
10/09/2010
sp_UserOfflineSmall Offline

Thank you Tony for replying for quickly first. But I think you're mistaken of my question. I do read the your suggested post several times before I posted this topic. Your example only works perfect in the adding records mode. The onchanged will be triggered also in the editing mode. But for the editing mode, the 2nd dropdown(State) should retrieve data first according to the 1st dropdown(Country) initiailly. My question is how to get the value of 1st dropdown(Country) to make the 2nd dropdown load correct data first.  And another question is because the form navigation is available, when user navigate dirrerent rows, the 2nd dropdown(State) should load data again according to the value of 1st dropdown(Country). How can I make it work? Hope you can understand my question. Thank you.

Image Enlarger

11/09/2010
14:25
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Yes this is true.

Use beforeShowForm – get the value from the first select and based on this value do a ajax and fill the second select.

We have a example in our commertial PHP component here.

http://www.trirand.com/blog/ph.....efault.php

Click on PHP Tab to see the beforeShowForm code.

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