小弟目前的项目是用EXT3.3作为页面的展示技术,目前遇到这么一个奇怪的问题,在一个列表查询页面中,使用了一个grid,代码如下:
var grid_todo = new Ext.grid.GridPanel({
id:'taskGrid',
loadMask: {msg: '载入中,请稍候...'},
store: store_todo,
viewConfig: {
autoFill : true,
forceFit: true,
scrollOffset: -3
},
collapsible: true,
bodyStyle: 'width:100%;',
//autoWidth:true,
//autoHeight: true,        
columns: [
{id: 'id',header: "Id", sortable: false, dataIndex: 'id',hidden: true,menuDisabled: true},
{header: "类型", sortable: false, dataIndex: 'catValue',menuDisabled: true},
{header: "标题", width: 160, sortable: false, dataIndex: 'dataTabDescription',menuDisabled: true},
{header: "日期", width: 75, sortable: false,  dataIndex: 'batchname',menuDisabled: true},
{header: "状态", width: 75, sortable: false,  dataIndex: 'status',renderer:randerAuditStatus,menuDisabled: true},
{header: "负责人", width: 75, sortable: false,  dataIndex: 'name',menuDisabled: true}
],
stripeRows: true,
autoExpandColumn: 'field0',
height: 340,
width: 800,
title: '查询结果显示区域',
bbar: pageTool_todo
});
grid_todo.render('table_div_listToDoItem');
一个josnStore:var store_todo = new Ext.data.JsonStore({
url: "<%=request.getContextPath()%>/ajax/kpi/forms/listToDoItemAction.do",
root: "data.modulars",
totalProperty: 'data.pager.totalSize', 
remoteSort: true,
//sortInfo: {field: "name", direction: "ASC"},
fields: [
{name: 'catValue', mapping: 'catValue'},
{name: 'dataTabName', mapping: 'dataTabName'},
{name: 'dataTabDescription', mapping: 'dataTabDescription'},
{name: 'batchname', mapping: 'batchname'},
{name: 'status', mapping: 'status'},
{name: 'name', mapping: 'name'},
{name: 'id', mapping: 'id'}
],
listeners: {
loadexception: function() {
alert("列表数据读取错误.");
},
load: {
fn: function(store, records, options) {
grid_todo.render('table_div_listModulars');
}
}
}
});
store_todo.on('beforeload', function() {
Ext.apply(this.baseParams, {
busiType: searchPanel_todo.getForm().findField("busiType").getValue(),
dataStatus: searchPanel_todo.getForm().findField("dataStatus").getValue(),
endDate: searchPanel_todo.getForm().findField("endDate").getValue(),
startDate: searchPanel_todo.getForm().findField("startDate").getValue()
});
});
还有一个分页栏:var pageTool_todo = new Ext.PagingToolbar({
pageSize: 10, 
store: store_todo, 
displayInfo: true, 
displayMsg: '显示第  {0} 条到  {1} 条记录,一共  {2} 条', 
emptyMsg: '没有记录',
paramNames: {start: 'pager.currentPage', limit: 'pager.pageSize'},
plugins: new Ext.ux.ProgressBarPager()
});问题是这样的,我在grid中注册了一个点击事件,用来弹出一个子页面:
var listToDoPopup = new Ext.Window({
id: 'formPopupWin',
layout: 'fit',
width: 650,
height: 550,
closeAction: 'hide',
autoDestroy: true,
shadow: true,
modal: true,
iconCls: 'tabs',
closable: true,
bodyStyle:'padding:5 5 5 5',
resizable: false,
animCollapse: true,
draggable: false,
plain: true,
listeners: {
hide: function() {
pageTool_todo.doRefresh();
}
},
autoLoad: {url:url,scripts:true}
});
然后再关闭子页面的时候调用分页栏的刷新方法实现父页面的刷新。后来发现在最后一页操作完子页面并刷新父页面之后,页面会返回原来的倒数第二页,也就是现在的最后一页。因为我的列表总数变化了,本来这样是没错的。
但是,此时分页栏的当前页就发生了错误,本来是灰色的下一页和最后一页按钮也变成了可点击的,并且点击时候页面的数据也就是不是正确的数据了。
请问一下,这个问题如何解决?谢谢!