我正在开发一个使用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