I got a basic jqGrid working in my coldfusion project. One of my fields in jqGrid is a combo box. Currently the editoption values are hard coded just like below.
<
I know this is an old question, but it I've find the same problem.
I solve this by combination of dataUrl and ajaxSelectOptions.
colModel:[
//class_id
$.extend(true,
{
name:'class_id'
,index:'class_id'
,edittype:'select'
,formatter:'select'
,editoptions: { dataUrl:"db.php?ajaxOp=getClassesOptions" } //to send dynamic parameter, combine with ajaxSelectOptions
}
,{}
)
Note that dataUrl string ARE static, means you cannot send different parameters each time add/edit occurs. Below code WILL NOT WORK !
,editoptions: { dataUrl:"db.php?ajaxOp=getClassesOptions" + "&id="+selected_id }
To send parameters such id, you can use ajaxSelectOptions .
ajaxSelectOptions: //use this for combination with dataUrl for formatter:select
{
data: {
id: function () {
return selected_id;
}
}
},
The function which return selected_id will be executed each time the add/edit occurs. Hope this helps !