Forum


15:49

10/09/2010

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.
19:19

Moderators
30/10/2007

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.
23:13

10/09/2010

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.
14:25

Moderators
30/10/2007

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.
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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66