Reputation: 6181
I am developing a web application using JSP & Servlet (IDE: Eclipse, Database: Oracle10). I am using jqGrid
to display records in tabular format.
code snippet:
{name:'CITY',index:'CITY', width:70,editable:true,edittype:"select",editoptions: {dataUrl: 'ProfileServ?action=comboCity', dataEvents: [{ type: 'change', fn: function(e) {alert(this.value);city= this.value;}}],}},
{name:'PIN',index:'PIN', width:200,sortable:false,editable:true, edittype:"select",editoptions: {dataUrl: 'ProfileServ?action=comboPin'}},
I want to change values of PIN
according to the value selected in CITY
. I have used dataEvents
and type: 'change'
to get the selected value of CITY
. I am successfully getting the selected value of CITY
.
My question is that how should I update the values of PIN
when value of CITY
is changed?
Upvotes: 0
Views: 254
Reputation: 221997
Unfortunately there is no easy way to implement dependent selects. One have to update the whole <select>
of dependent select manually inside of change
callback (update selects of PIN in your case). The only which I can suggest you is examining the code of the demo from the answer. It is not exactly what you need because it don't use dataUrl
, but it shows what should be done.
Upvotes: 1