如何在INLINE编辑后重新加载struts2中的jqgrid

时间:2013-02-15 15:10:33

标签: java jquery jqgrid struts2 struts2-jquery-grid

我在网格上进行内联编辑,我想在编辑或添加或删除一行后重新加载我的jqgrid,CRUD方法正常工作 正确,但网格不重新加载! 这是我的jsp文件:

<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',{});
});

1 个答案:

答案 0 :(得分:0)

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

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

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

});

您可以使用jqGrid卸载功能。

$("[#NAME]")jqGrid('GridUnload');