I am using jqGrid
to show data in tabular format, using JSP
and Servlet
.
I have two dependent drop-downs to show.
- Show State
- Show City
Following is relevant code:
colNames:['User ID', 'Name','State','City'],
colModel:[
{name:'USERID',index:'USERID',....},
{name:'NAME',index:'NAME',....},
{
name:'STATE',
index:'STATE',
width:125,
sortable:true,
edittype:"select",
editoptions: {
maxlength: 15,
dataUrl: 'MYServlet?action=getState',
dataEvents :[{
type: 'change',
fn: function(e) {
var thisval = $(e.target).val();
$.post('MyServlet?action=getCity='+thisval,
function(data){
var res = $(data).html();
$("#STATE").html(res);
});
}
}]
}
},
{
name:'CITY',
index:'CITY',
width:125,
sortable:true,
editable:true,
edittype:"select",
editoptions:{maxlength: 50 , value: 'Select:Select'}
}
],
Above code is working fine for dependent drop-downs. Now I want to pass USERID
with datUrl
in editoptions
of STATE
column. like
dataUrl: 'MYServlet?action=getState&userid='+userid
But I am not able to get USERID
in dataUrl
.
So any suggestions will be appreciated.