GridPanel 分页问题.Ext 大侠 救命啊~~~~帮顶有分

Robinfu2013 Robinfu2013 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
问题是这样的,GridPanel 能取到所有的值。但是分页无效。可以翻页。但是翻页数据无任何变化。都是所有数据。
mystore.load({ params: { start: 0, limit: 10} }); ←个人理解这句应该是加载的时候只加载部分数据吧?
还有PagingToolbar 的 pageSize 也设置了,就是控制不住...囧啊..各位大侠谁知道原因,告诉一声谢谢。
下面是代码

Ext.onReady(function () {
Ext.QuickTips.init();
//Ext.state.Manager.setProvider(new Ext.state.CookieProvider());

//设置代理数据
var proxy = new Ext.data.HttpProxy({
url: '/action/S_MediaData.aspx',
method: 'GET'
});



// create the data store
var mystore = new Ext.data.Store({
proxy: proxy,
reader: new Ext.data.JsonReader({
root: 'topics',
totalProperty:'totalProperty',
id: 'ML_Autoid'
},['ML_Autoid', 'M_Name', 'A_ID', 'M_lv', 'Perfect'])
});
mystore.load({ params: { start: 0, limit: 10} });

//定义列
var colM = new Ext.grid.ColumnModel([
{ header: '编号', dataIndex: 'ML_Autoid', sortable: true },
{ header: '名称', dataIndex: 'M_Name' },
{ header: '地区', dataIndex: 'A_ID' },
{ header: '级别', dataIndex: 'M_lv' },
{ header: '状态', dataIndex: 'Perfect' },
{
header: '删除',
xtype: 'actioncolumn',
width: 50,
items: [{
icon: '/js/ext3.3/examples/shared/icons/fam/delete.gif', // Use a URL in the icon config
handler: function (grid, rowIndex, colIndex) {
var rec = mystore.getAt(rowIndex);
recid = rec.get('ML_Autoid');
Ext.MessageBox.show({
title: '删除 ' + rec.get('M_Name') + '?',
msg: '确定删除 ' + rec.get('M_Name') + ' 这条记录?',
buttons: Ext.MessageBox.YESNO,
fn: delRecord,
icon: Ext.MessageBox.QUESTION
});

},
tooltip: 'Sell stock'
}]
},
{
header: '更新',
xtype: 'actioncolumn',
width: 50,
items: [{
icon: '/js/ext3.3/examples/shared/icons/fam/application_go.png', // Use a URL in the icon config
handler: function (grid, rowIndex, colIndex) {
var rec = mystore.getAt(rowIndex);
alert("Sell " + rec.get('ML_Autoid'));
},
tooltip: 'Sell stock'
}]
}

]);

//create the gridpanel
var grid = new Ext.grid.GridPanel({
store: mystore,
stripeRows: true,
//autoExpandColumn: 'ML_Autoid', 自动填充字段
autoHeight : true,
bodyStyle : 'width:100%',
autoHeight: true,
cm: colM,
loadMask: true,
autoWidth : true,
border:false,
title: '媒体库管理',
// config options for stateful behavior
stateful: true,
viewConfig: {
forceFit: true
},
stateId: 'grid',
tbar : new Ext.Toolbar({
items : [{
id : 'btnAdd',
icon: '/js/ext3.3/examples/shared/icons/fam/add.gif',
text : "添加",
handler : function() {
Ext.MessageBox.alert("添加","做添加的操作");
}
}
]

}),

bbar: new Ext.PagingToolbar({

pageSize: 10,
store: mystore,
displayInfo: true,
displayMsg: '第{0} 到 {1} 条数据 共{2}条',
emptyMsg: "没有数据"

})
});

// render the grid to the specified div in the page
grid.render('grid-example');

function delRecord(btn)
{
if(btn=="yes"){
alert(recid);
}
}
});
...全文

相关推荐

评论 6
收藏 已收藏
分享
返回顶部
Robinfu2013
.NET社区 62,272 成员 668,968 内容