I am developing a web application using JSP & Servlet (IDE: Eclipse, Database: Oracle10). I am using jqGrid to display records in tabular format.
I want to get values for combobox in jqGrid
from servlet, so far I have done following.
I am accessing the array passed by Servlet in JSP scriplet.
<%
String[] stageIDs = (String[])request.getAttribute("combo");
%>
Following is my 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});
But I am getting an exception in for loop line
where I am assigning the editoptions to the combobox. Please let me know is there any mistake in code.
My another question is that is there any better way of assigning values to combobox in jqGrid from servlet (without using scriplet)?