js 方面 我没有用mvc 模式 简单实现以下功能
先写store
me.pigFileStore = Ext.create("Ext.data.Store", {
id : 'pigFileStore',
fields : ['pigpenNumber','name'],
pageSize:10, //*注意这里 要写上每页显示多少条 不然会无限翻页的
proxy : {
type : 'ajax',
url : totalPath + '/mobile/mobilePigPen!phonePagedQuery.action',
reader : {
type : 'json',
rootProperty : 'data',
totalProperty : 'totalCount' //后台需要返回一个总条数对象
}
},
autoLoad : true,
listeners : {
load : function(scope, record) {
console.log(record);//我测试用的 习惯了
}
}
});
下面是list //API直接复制的 西面是分页 也是从别人那里借鉴的
me.pigFileList = Ext.create("Ext.List", {
store : me.pigFileStore,
itemTpl: '{pigpenNumber}</br>{name}',
iconCls: 'home',
onItemDisclosure: function(record) {
alert(record.data.id);
console.log(record.data.name);
},
plugins : [/*{
xclass : 'Ext.plugin.PullRefresh',
pullRefreshText : '下拉可以更新',
releaseRefreshText : '松开开始更新',
loading : '正在刷新……',
refreshFn : function(loaded, arguments) {
loaded.getList().getStore().loadPage(1, {
callback : function(record, operation, success) {
Ext.Viewport.unmask();
},
scope : this
});
}
},*/ //这一部分注释掉了 这一部分是从上往下拉时的 我暂时没用上
//下面就是滚动分页的实现了
{
xclass : 'Ext.plugin.ListPaging',
loadMoreText : '上拉显示更多……',
noMoreRecordsText : '没有更多条记录了',
autoPaging : true
// 设置为TRUE将自动触发
}]
});