//注意红字部分。由于分页的时候,需要带上原始的参数。所以需要监听事件上,配置参数
var store = new Ext.data.Store({
pageSize : 20,
fields : [ {
name : 'id',
type : 'string'
}, {
name : 'name',
type : 'string'
}, {
name : 'type',
type : 'string'
} ],
proxy : {
type : 'ajax',
url : 'test!loadData.action',
extraParams : {
type: ‘testType’
},
reader : {
type : 'json',
root : 'data'
}
},
listeners : {
"beforeload" : function() {
Ext.apply(store.proxy.extraParams, {
limit : 20,
type: ‘testType’
});
}
}
});

本文介绍如何在ExtJS中实现带参数的分页功能,重点讲解了使用Ext.data.Store进行分页时如何传递额外参数的方法。通过具体代码示例展示了如何设置Store的基本属性,包括字段定义、Ajax代理配置及监听事件等。
1586

被折叠的 条评论
为什么被折叠?



