2013-02-15 56 views
0

我正在做一個網格的內聯編輯,我想在編輯或添加或刪除一行後重新加載我的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',{}); 
}); 

回答

0
$.subscribe('rowadd', function(event,data) { 

    $("#idGridApplication").jqGrid('GridUnload'); 

    $("#idGridApplication").jqGrid('editGridRow',"new",{height:280,reloadAfterSubmit:false}); 

}); 

可以使用jqGrid的卸載功能。

$("[#NAME]")jqGrid('GridUnload'); 
相關問題