我正在開發一個使用JSP的Web應用程序& Servlet(IDE:Eclipse,Database:Oracle10)。 我正在使用jqGrid以表格格式顯示記錄。jqGrid組合框:如何動態添加值
我想從servlet中獲得組合框jqGrid
的值,到目前爲止我已經完成了以下操作。
我正在訪問由JSP scriplet中的Servlet傳遞的數組。
<%
String[] stageIDs = (String[])request.getAttribute("combo");
%>
以下是我colModel:
jQuery("#list10_d").jqGrid({
height: "100%",
url:'ProtocolJGridServChild?q=2&action=protAction',
datatype: "xml",
colNames:['Sr. No.','PID', 'SID'],
colModel:[{name:'srNo',index:'srNo', width:35,sortable:true},
{name:'PID',index:'PID', width:100,sortable:false,editable:true,hidden:true},
{name:'SID',index:'SID', width:100, sortable:false, editable:true, edittype:"select",editoptions:{value:<%for(int i=0;i<stageIDs.length;i++)%><%="ID:"+ stageIDs[i]+";"%>}}
],
rowNum:2,
rowList:[2,4,6],
pager: '#pager10_d',
sortname: 'PID',
viewrecords: true,
sortorder: "asc",
multiselect: true,
editurl: "MyServletName",
caption:"CRM_PROT_ACTIONS",
}).navGrid('#pager10_d',{edit:true,add:true,del:true});
但我在for loop line
得到一個例外,我分配editoptions到ComboBox。請讓我知道代碼中是否有任何錯誤。
我的另一個問題是,有沒有更好的方法來從servlet中分配值到jqGrid中的組合框(不使用scriplet)?
感謝(再次)..它的工作原理採用dataurl ... – Bhushan
@Bhushan:歡迎您! – Oleg