如何在INLINE编辑后在struts2中重新加载jqgrid
问题描述:
我正在做一个网格的内联编辑,我想在编辑或添加或删除一行后重新加载我的jqgrid,CRUD方法正确工作 ,但网格不重新加载! 这是我的JSP文件:如何在INLINE编辑后在struts2中重新加载jqgrid
<s:url id="remoteurlApplication" action="applicationList" />
<s:url id="editurlApplication" action="applicationEdit" />
<sjg:grid
id="idGridApplication"
caption="Liste des applications"
dataType="json"
href="%{remoteurlApplication}"
pager="true"
navigator="true"
navigatorSearchOptions="{sopt:['eq','ne','lt','gt']}"
navigatorAddOptions="{height:150,reloadAfterSubmit:true}"
navigatorEditOptions="{height:150,reloadAfterSubmit:true}"
navigatorEdit="false"
navigatorView="false"
navigatorDelete="true"
navigatorDeleteOptions="{height:150,reloadAfterSubmit:true}"
gridModel="gridApplications"
rowList="10,15,20"
rowNum="15"
editurl="%{editurlApplication}"
editinline="true"
viewrecords="true"
width="1000"
shrinkToFit="false"
>
<sjg:gridColumn hidden="true" name="idApplication" index="idApplication"
title="ID" formatter="integer"
editable="true" sortable="false" width="300"
/>
<sjg:gridColumn name="nomApplication" frozen="true" title="application"
editable="true" edittype="text"
width="700"
/>
</sjg:grid>
这是我的js文件:
$.subscribe('rowadd', function(event,data) {
$("#idGridApplication").jqGrid('editGridRow',"new",{height:280,reloadAfterSubmit:false});
});
$.subscribe('searchgrid', function(event,data) {
$("#idGridApplication").jqGrid('searchGrid', {sopt:['cn','bw','eq','ne','lt','gt','ew']});
});
$.subscribe('showcolumns', function(event,data) {
$("#idGridApplication").jqGrid('setColumns',{});
});
答
$.subscribe('rowadd', function(event,data) {
$("#idGridApplication").jqGrid('GridUnload');
$("#idGridApplication").jqGrid('editGridRow',"new",{height:280,reloadAfterSubmit:false});
});
可以使用jqGrid的卸载功能。
$("[#NAME]")jqGrid('GridUnload');