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

时间:2021-03-02 14:30:51

I'm doing inline edits on a grid and i want to reload my jqgrid after editing or adding or deleting a row, the CRUD methode works correctly but the grid doesn't reload !! This is my jsp file :

我正在网格上进行内联编辑,我想在编辑或添加或删除一行后重新加载我的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>

And this is my js file:

这是我的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 个解决方案

#1


0  

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

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

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

});

You can use jqGrid unload function.

您可以使用jqGrid卸载功能。

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

#1


0  

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

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

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

});

You can use jqGrid unload function.

您可以使用jqGrid卸载功能。

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