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
Chained select box in dialog form
07/04/2009
08:07
Avatar
Sam
Member
Members
Forum Posts: 5
Member Since:
07/04/2009
sp_UserOfflineSmall Offline

Hello,

First thanks for this great work, i try several things very useful with jqgrid and it's a great ajax grid.

However, i have a problem with chained select box. I use the dialog form to add/edit data in the grid, and I have 2 select boxs that i want chained.

I tried events like intializeForm without succes. If someone could show me the way to search or give a few exemples it will be great.

I just want to load data from php script on change of a select box and load in a second select box.

Thanks,

Samuel

P.S : Please excuse my english, i tried to be explicit, if you don't understand i can explain my problem in another way.

07/04/2009
08:45
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

In onInitializeForm is the right place to do this. Could you please post the 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.

07/04/2009
09:08
Avatar
Sam
Member
Members
Forum Posts: 5
Member Since:
07/04/2009
sp_UserOfflineSmall Offline

Thanks for your answer, this is the code i use :

).navGrid(”#nav_diplome_agricole”,
            {search:false,refresh:false}, // Options
            {reloadAfterSubmit:false}, // Options d\\'édition
            {reloadAfterSubmit:false}, // Options d\\'ajout
            {reloadAfterSubmit:false}, // Options de suppression
            {}, // Options de recherche           
            {onInitializeForm :function(form_id){
                $(”#etablissement_diplome_id_etablissement_diplome”, form_id).change(function(){

                  // alert(”Test”);

                 var id_etablissement_diplome = “”;
                  $(”#etablissement_diplome_id_etablissement_diplome option:selected”).each(function () {
                        id_etablissement_diplome = $(this).val();
                  });

                  // Appel du script php et récupération du code HTML généré
                  var html_liste = $.ajax({
                    url: “ajax/chargement.php?id_etablissement=”+id_etablissement_diplome,
                    async: false
                   }).responseText;
                  
                  $(”#diplome_id_diplome”).html(html_liste);   
                })
            }}                   
          );

#etablissement_diplome_id_etablissement_diplome = id of my first select box
#diplome_id_diplome = id of my second select box
chargement.php is a script witch return html code of second select box

Perhap's there is already more information in the doc, but i don't find it.

Thanks a lot

Samuel

09/04/2009
10:44
Avatar
Sam
Member
Members
Forum Posts: 5
Member Since:
07/04/2009
sp_UserOfflineSmall Offline

Hi,

Any idea ? Since i post i tried some new research with no result.
If anyone can help Wink

Thanks

14/04/2009
02:25
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Not sure, but take a look in the ajax, maybe you need

$.ajax({

...

complete: function(response, stat) {

$(”#diplome_id_diplome”).html(response.responseText);

}

...

});

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.

15/04/2009
08:22
Avatar
Sam
Member
Members
Forum Posts: 5
Member Since:
07/04/2009
sp_UserOfflineSmall Offline

Hello,

Thanks for your answer Tony and for the time you spend in support.

About my problem, it seems that i don't use onInitializeForm correctly.
In fact, if i try this :

{onInitializeForm:function(form_id){               
                alert("Test");
}}

Nothing append, i already try something simple like :

{onInitializeForm:function(form_id){               
          html_liste = "<span>Test</span>";                  
          $("#diplome_id_diplome").html(html_liste);
}}

Is there any example i can use somewhere to continue my search ?
Thanks a lot,

Sam

16/04/2009
03:16
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

If I see your previous post - Yes you do not use the event in the right place.

The princip is to include the event in the appropriate options and not at end.

Here is the example:

).navGrid(”#nav_diplome_agricole”,
            {search:false,refresh:false}, // Options
            {reloadAfterSubmit:false,

onInitializeForm: function (formid) {

// do something here

}

}, // Options d\\'édition
 {reloadAfterSubmit:false,

onInitializeForm : function (formid){

// do something here

}

}, // Options d\\'ajout
   {reloadAfterSubmit:false}, // Options de suppression
  {}

);

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.

28/05/2009
07:26
Avatar
Sam
Member
Members
Forum Posts: 5
Member Since:
07/04/2009
sp_UserOfflineSmall Offline

Sorry for time to respond.
This is exactly the solution of my problem.

Thanks a lot ;o)

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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