I'm using a jqGrid. For add popup for combobox i'm using default data from the database which works fine. But when edit popup is displayed its not showing the selected value in combobox instead showing 1st value in the list specified.
The following is my code:
$("#list").jqGrid({
url:'<%=request.getContextPath()%>/getDetail.jsp',
datatype: 'xml',
mtype: 'GET',
colNames:['DataChannel ID','Description','Date Creation(MM/dd/yyyy)','Date Closure(MM/dd/yyyy)','Frequency','Source Type','Source Data Type','Primary Data Source','Secondary Data Source','Data Available From(MM/dd/yyyy)','Lag','Advance Alert','Confidentiality Type','Data Flow Type','PSM Name','Comment','Data Available Upto(MM/dd/yyyy)'],
colModel :[
{name:'DESCRIPTION', index:'DESCRIPTION',editable:true,editrules:{required:true}, width:120},
{name:'DATE_CREATION', index:'DATE_CREATION', editable:true,editrules:{required:true}, width:80},
{name:'DATE_CLOSURE', index:'DATE_CLOSURE', editable:true,width:80},
{name:'PRIMARY_SOURCE_ID', index:'PRIMARY_SOURCE_ID',editable:true,edittype:"select",
edittype:"select",editoptions:
{dataInit:function(elem){alert(elem);},value:"<%ctr=0;count=sourceList.size();for (itr=sourceList.iterator(); itr.hasNext(); ) {ctr++;sourceMap=(HashMap)itr.next();it = sourceMap.entrySet().iterator();while (it.hasNext()) {pairs = (Map.Entry)it.next();%><%=pairs.getKey()%>:<%=pairs.getValue()%><% if(ctr < count){%>;<%}}}%>"}, width:120},
{name:'DATA_AVAILABLE_UPTO', index:'DATA_AVAILABLE_UPTO',editable:false,width:100}],
pager: $('#pager'),
rowNum:10,
rowList:[10,20,30],
sortname: 'user',
sortorder: "desc",
viewrecords: true,
multiselect:false,
imgpath: '<%=request.getContextPath()%>/themes/steel/images',
caption: 'Data Channel Master Data',
editurl: '<%=request.getContextPath()%>/ChannelUpdate.jsp',
width:1700
}).navGrid('#pager',{add:true,addtext:'Add',edit:true,edittext:'Edit',del:true,deltext:'Del', search:true,searchtext:'Find',refresh:true}, //options
{height:300,width:500,reloadAfterSubmit:true}, // edit options
{height:300,width:500,reloadAfterSubmit:true}, // add options
{reloadAfterSubmit:true}, // del options
{} // search options
);
});
If i use dataUrl istead of value in editoptions of column 'PRIMARY_SOURCE_ID' then firebug is throughing an error
options.value is undefined
[Break On This Error] var so = options.value.split(";"),sv, ov;
Please help... How to get selected value in combobox for edit window.
Thanks in advance, Sandeep Vemula