Struts2 jQuery Grid重新加载问题 [英] Struts2 jQuery Grid reload issue

查看:152
本文介绍了Struts2 jQuery Grid重新加载问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面中关注了jQGrid

I have following jQGrid in my page

<sjg:grid           id="reportGrid" 
             gridModel="gridModel" 
             autowidth="true" 
          reloadTopics="refreshGrid" gridview="true"  
  onGridCompleteTopics="gridLoadComplete"           
       onSuccessTopics="dataLoadCompleted"   
             navigator="true" 
                 pager="true" 
       navigatorSearch="true" 
navigatorSearchOptions="{multipleSearch:true}" 
                scroll="true" 
                rowNum="10000" 
             hoverrows="false" 
       groupColumnShow="false" 
            groupField="['field1','field2']" 
                  href="webReport" 
               formIds="myform" 
              dataType="json" 
              loadonce="true" >
    ..........................
    ..........................
    ..........................
</sjg:grid>

和一个按钮

<sj:a button="true" 
  buttonIcon="ui-icon-refresh" 
  buttonText="true"  
     onclick="reloadGridFunc();">
    Submit
</sj:a>

在JS中我有这个

function reloadGridFunc()
{

    $("#reportGrid").jqGrid('setGridParam',{datatype:'json'});      
    $.publish("refreshGrid");

    // $("#reportGrid")
    //  .jqGrid('setGridParam',{url:"userReport",datatype:"json"}).
    trigger("reloadGrid");

}

$.subscribe('gridLoadComplete', function(event, data) {
    // $("#reportGrid").jqGrid('clearGridData');    
    // $('#reportGrid').setGridParam({ page: 1, datatype: "json"})
    //    .trigger('reloadGrid');   
    // $("#reportGrid").trigger('reloadGrid');          
});

$.subscribe('dataLoadCompleted', function(event, data) { 
    // $("#reportGrid").trigger('reloadGrid');
});

但是我看到的是网格填充了新数据,但是没有清除分组.我必须按下网格底部的重新加载按钮以刷新网格,然后数据表示看起来很好.

but what I am seeing is that the grid populates with new data but the grouping is not cleared; I have to press the reload button on bottom of the grid to refresh the grid, and after that the data representation looks fine.

我有一个表格,其中存在网格,锚点和其他html元素,根据这些,我选择了不同的条件,然后单击填充网格的按钮,当我更改条件时,网格将重新填充,但是保留了旧的分组我必须按网格中的重新加载按钮才能解决此问题.

I have a form in which a grid , anchor and other html elemets exists, and according top these i select different criteria and click the button the grid is poplulated and when i change the criteria the grid repopulate but the old grouping is preserved i have to press the reload button in grid to fix this.

推荐答案

网格完成后,它会检查onGridCompleteTopics的订阅者.

When the grid is completed it checks for the subscribers of the onGridCompleteTopics.

以逗号分隔的主题列表,在所有数据 加载到网格中,其他所有过程均已完成.

A comma delimited list of topics that published after all the data is loaded into the grid and all other processes are complete.


网格成功后,它会检查onSuccessTopics的订户.


When the grid is succeeded it checks for the subscribers of the onSuccessTopics.

以逗号分隔的主题列表,当元素ajax请求成功完成时发布(如果提供,它将覆盖目标容器的设置).

A comma delimited list of topics that published when the element ajax request is completed successfully (will override settings for a target container if provided).


如果未找到主题事件的订阅者,则不会将他们绑定到网格.因此,在检查主题的订阅者之前,请确保已订阅该网格.


If no subscribers is found for the topic event, they won't be bound to the grid. So, make sure you subscribe to the grid before it checks for topic's subscribers.

查看带有主题的网格的示例.

See an example of grid with topics.

重新加载网格的代码

</sjg:grid>
<script type="text/javascript">
  $(document).ready(function(){
    $("#reportGrid").trigger("reloadGrid");
  });
</script> 

这篇关于Struts2 jQuery Grid重新加载问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆