Extjs分页问题

cheer1226 2012-04-20 11:27:43
  bbar: new Ext.PagingToolbar({  
pageSize:5,
store: storedept,
displayInfo: true,
displayMsg: '显示第 {0} 条到 {1} 条记录,一共 {2} 条',
emptyMsg: "没有记录",

页面上第一页显示是5条,点击下一页,后台输出已经得到第二页内容,但是前台页面没反应,还是第一页内容,我的分页到底哪出了问题,请ext高手指教
...全文
138 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
artair 2012-04-24
  • 打赏
  • 举报
回复
代码贴全
cheer1226 2012-04-24
  • 打赏
  • 举报
回复
怎么没人回答
cheer1226 2012-04-24
  • 打赏
  • 举报
回复
上边是全部代码
cheer1226 2012-04-24
  • 打赏
  • 举报
回复
Ext.onReady(function() {
var storedept = new Ext.data.JsonStore({
baseParams: {
dwid: '100000',
start:0,
limit:5

},
root: 'rows', //json中的rows对象
totalProperty: 'total',//行数
idProperty: 'CId',//代理缓冲中排序的列
remoteSort: true,//是否在代理缓冲中排序
fields: [ //配置index1Grid列的信息
'CId', 'SName','SShortname', 'CUnitId', 'IXh',
],
proxy: new Ext.data.HttpProxy({//以post形式 代理获取数据
url:'servlet/GetDeptByUnitServlet',
method:'post'
})
});
//展示数据的index1Grid
var index1Grid = new Ext.grid.GridPanel({
//width:1000,
height:300,
title:'部门列表',
store:storedept ,
viewConfig: {
forceFit: true,
columnsText: '列',
sortAscText: '升序',
sortDescText: '降序'
},
trackMouseOver:false,
disableSelection:false,//选择显示斑马线
loadMask: true, //加载时有loading等待显示
// index1Grid列配置
columns:[{header: " 部门ID",dataIndex: 'CId', width: 120,sortable: true},
{header: "部门名称",dataIndex: 'SName',width: 100,align: 'center',sortable: false},
{header: "部门简称",dataIndex: 'SShortname',width: 100,align: 'center',sortable: false},
{header: "所属单位",dataIndex: 'CUnitId',width: 130,align: 'center',sortable: false},
{header: "显示序号",dataIndex: 'IXh',align: 'center',sortable: false}],

// paging bar on the bottom
bbar: new Ext.PagingToolbar({
pageSize:5,
store: storedept,
displayInfo: true,
displayMsg: '显示第 {0} 条到 {1} 条记录,一共 {2} 条',
emptyMsg: "没有记录",
items:[
'-', {
pressed: true,
enableToggle:true,
text: '显示用户列表',
cls: 'x-btn-text-icon details',
toggleHandler: function(btn, pressed){
if(index1Grid.getSelectionModel().getSelections().length==0){
Ext.Msg.alert("提示","请选择一行"); return;
}
var gridSelecteds = index1Grid.getSelectionModel().getSelections();
var deptid = gridSelecteds[0].data.CId;
Ext.Msg.alert("提示",deptid);
//动态设置用户列表的参数
storeuser.on('beforeload',function(){
Ext.apply(
this.baseParams,
{
deptid:deptid
});
});
storeuser.removeAll();
storeuser.load({params:{start:0,limit:5,deptid:deptid }});

}
}]
}),
tbar: [
"按名称过滤",{
xtype: 'textfield',
fieldLabel: '',
name: 'bmmc'
},'-',
new Ext.Button({
text: '查询 ',
pressed: true,
icon:'ext-3.2.1/examples/shared/icons/fam/grid.png',
handler: function (saveBtn, event) {
//查询部门
var bmmc=Ext.fly("bmmc").getValue();
Ext.Msg.alert("提示", bmmc);
//下面的语句完成搜索并将Grid1Panel中的值重新加载
var searchProxy = new Ext.data.HttpProxy({url:"servlet/GetDeptByNameServlet" });
storedept.proxy = searchProxy;
storedept.load({params: {start: 0, limit: 5, bmmc: bmmc}});

},scope:this
}),'-',new Ext.Button({
text: '添 加 ',
pressed: true,
icon:'ext-3.2.1/examples/shared/icons/fam/add.png',
handler: function (saveBtn, event) {
deptForm.getForm().reset();
deptwin.show();
},scope:this
}),'-',new Ext.Button({
text: '修 改 ',
pressed: true,
icon:'ext-3.2.1/examples/shared/icons/fam/cog_edit.png',
handler: function (saveBtn, event) {
if(index1Grid.getSelectionModel().getSelections().length==0){
Ext.Msg.alert("提示","请选择一行"); return;
}
var record = index1Grid.getSelectionModel().getSelected();

deptForm1.getForm().setValues({//'CId', 'SName','SShortname', 'CUnitId', 'IXh',
"deptid": record.get("CId"),
"deptName": record.get("SName"),
"deptShortName":record.get("SShortname"),
"xh":record.get("IXh")
});
},scope:this
}),'-',new Ext.Button({
text: '删 除 ',
pressed: true,
icon:'ext-3.2.1/examples/shared/icons/fam/delete.gif',
handler: function (saveBtn, event) {
var gridSelected = index1Grid.getSelectionModel().getSelections();
if(gridSelected==0){
Ext.Msg.alert("提示","请选择一行");
return ;
}
Ext.Msg.confirm("提示", "确定要删除吗?", function (btn) {
if (btn == "yes") {
var deptid = gridSelected[0].data.CId;
Ext.Msg.alert("提示",deptid);
Ext.Ajax.request({
url: "servlet/DeleteDeptServlet",
success: function (response) {
Ext.Msg.alert("提示", "删除成功", function () {
index1Grid.store.reload();
});

},
failure: function (response) {
Ext.Msg.alert("提示", "失败");
},
params: { deptid: deptid }
});
}
});
},scope:this
})
]
});
//加载数据
// storedept.removeAll();
storedept.load({params:{start:0, limit:5}});

87,907

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧