Forum


05:19

04/12/2008

Hi to all !!
I'm trying to make a select / combobox dynamic in a subgrid when click in add or edit button of navigation. The main grid contains student and the subgrid contains subject areas (physics, music, mathematical sciences, ....). A student can study one or more subjects, ¿ok?
I'm use the method 'onInitializeForm' in subgrid.
This is the code:
.... // in add options
onInitializeForm: function (formid) {
$.ajax({
type: "POST",
url:'dame_datos.php?nd='+new Date().getTime()+'&q=T&idc='+row_id,
// I pass the student id for sql get me only the subjects which not study.
// in the sql result, i get this data:
// {"rows":[["2","Music"],["3","Mathematical"]]}
// because this student was registered in physical, ¿ok?
datatype: "script",
success: function(grupos){
// #asignaturas is the combobox
$('#asignaturas',formid).append('<option value="' + ¿what? + '">' + ¿what? + '</option>');
}
});
}
My problem: I' can't / I don't know capture this values in the combobox.
Regards
06:48

Moderators
30/10/2007

Hello,
Do you want to populate the values only once or every time you open the form?
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.
03:03

Moderators
30/10/2007

Hello,
If every time you want to populate the select when the form is open (i.e. if every time click on add or edit buttons) I think that beforeShowForm is the right event for you.
onInitializeForm is called only once when the form is created, but beforeShowForm every time we click on one of these buttons.
Define in colModel select with emty values
{ name: "myselect", edittype: "select", editoptions:{" : "}...}
then you can configure your server to return the html like this:
<option value="1">One</option>
....
The code:
beforeShowForm : function (formid) {
$.ajax({
....
success : function(response) {
$("#myselect",formid).empty().html(response.responseText);
}
...
});
}
If you want this to happen only once make this in onInitializeForm
Hope this helps
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:
99 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