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
Combobox dynamic in a subgrid
18/12/2008
05:19
Avatar
pequesalta
Member
Members
Forum Posts: 7
Member Since:
04/12/2008
sp_UserOfflineSmall Offline

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

18/12/2008
06:48
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

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.

18/12/2008
07:42
Avatar
pequesalta
Member
Members
Forum Posts: 7
Member Since:
04/12/2008
sp_UserOfflineSmall Offline

Hello Tony,

Every time because each student will be enrolled in differents subjects.

Regards.

20/12/2008
03:03
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

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.

22/12/2008
00:06
Avatar
pequesalta
Member
Members
Forum Posts: 7
Member Since:
04/12/2008
sp_UserOfflineSmall Offline

Hi! Tony.

I tested with beforeShowForm. That's ok.

You're great.

Thanks for all. Regards.

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information