我的项目是Spring MVC + Hibernate + MySQL和JSP以及JQGrid 5.1作为前端。我面临的典型情况是,在JQGrid 删除行功能中,除了'oper'和'id'之外,我还想向控制器传递两个参数。一个参数是字符串,我可以毫无问题地传递它,但是另一个参数是组合框中的选定值,在下面的代码段中,我得到整个HTML而不是简单选择的组合框项值。 / p>
我得到的HTML作为'cmpcode'的选定值如下:
<select role="select" class="editable inline-edit-cell ui-widget-content ui-corner-all" id="3_cmpcode" name="cmpcode" rowid="3">null<option value="1" role="option">Test Company</option><option value="2" role="option">Test-2-new</option><option value="3" role="option">Niyogi Enterprise</option><option value="4" role="option">Test-4</option><option value="5" role="option">SySoft Computers</option><option value="6" role="option">Rohi-Nirag</option><option value="7" role="option">TYB and Co</option></select>
删除行的代码段如下:
{
caption: "Delete Branch Master",
msg: "Delete selected Branch?",
bSubmit: "Delete",
bCancel: "Cancel",
reloadAfterSubmit:true,
closeOnEscape:true,
onclickSubmit : function(eparams) {
var rowData = $("#list").jqGrid('getRowData', row_selected);
var retarr = {'brcode':rowData['brcode'],'cmpcode':rowData['cmpcode']};
return retarr;
}
这里,cmpcode是JQGrid中的一个组合框,其模型如下:
colModel:[
{name:'brcode',index:'brcode', width:50, editable:true, editrules:{required:true}, editoptions:{size:10}, formoptions:{elmprefix:'*'}},
{name:'brname',index:'brname', width:100, editable:true, editrules:{required:true}, editoptions:{size:30}, formoptions:{elmprefix:'*'}},
{name:'bradd1',index:'bradd1', width:100, editable:true, editoptions:{size:30, maxlength:60}, formoptions:{elmprefix:'*'}},
{name:'bradd2',index:'bradd2', width:100, editable:true, editoptions:{size:30, maxlength: 60}, formoptions:{elmprefix:'*'}},
{name:'brcity',index:'brcity', width:50, editable:true, editoptions:{size:20, maxlength:30}, formoptions:{elmprefix:'*'}},
{name:'brpin',index:'brpin', width:50, editable:true, editoptions:{size:20,maxlenght:6}, editrules:{required:true,number:true},formoptions:{elmprefix:'*'}},
{name:'bremail',index:'bremail', width:75, editable:true, editoptions:{size:30}, editrules:{required:true,email:true}, formoptions:{elmprefix:'*'}},
{name:'brcontactperson',index:'brcontactperson', width:75, editable:true, editoptions:{size:30}, formoptions:{elmprefix:'*'}},
{name:'cmpcode',index:'cmpcode',editable:true,edittype:'select',editoptions:{dataUrl:"/NioERPJ/admin/branchmstmgmt/listCmps"},formoptions:{elmprefix:'*'}}
我想得到组合框的选定值,我没有得到,请指导我,我也尝试了'getCell'方法,但没有获得价值。
答案 0 :(得分:0)