87,917
社区成员
发帖
与我相关
我的任务
分享
{"articleList":[{"articleId":1,"title":"1","author":"heshan","hits":"0","addDate":"2011-06-11 13:33:23"},{"articleId":2,"title":"2","author":"superman","hits":"0","addDate":"2011-06-11 13:35:18"},{"articleId":3,"title":"3","author":"superman","hits":"0","addDate":"2011-06-11 13:51:31"},{"articleId":4,"title":"4","author":"superman","hits":"0","addDate":"2011-06-11 13:55:54"},{"articleId":5,"title":"5","author":"superman","hits":"0","addDate":"2011-06-11 13:56:29"},{"articleId":6,"title":"拜拜拜拜吧","author":"superman","hits":"0","addDate":"2011-06-11 14:51:51"},{"articleId":7,"title":"333","author":"superman","hits":"0","addDate":"2011-06-11 15:00:56"},]}
var itemsPerPage = 2; // set the number of items you want per page
var store = Ext.create('Ext.data.Store', {
id:'simpsonsStore',
autoLoad: false,
fields:['name', 'email', 'phone'],
pageSize: itemsPerPage, // items per page
proxy: {
type: 'ajax',
url: 'pagingstore.js', // url that will load data with respect to start and limit params
reader: {
type: 'json',
root: 'items',
totalProperty: 'total'
}
}
});
// specify segment of data you want to load using params
store.load({
params:{
start:0,
limit: itemsPerPage
}
});
Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: store,
columns: [
{header: 'Name', dataIndex: 'name'},
{header: 'Email', dataIndex: 'email', flex:1},
{header: 'Phone', dataIndex: 'phone'}
],
width: 400,
height: 125,
dockedItems: [{
xtype: 'pagingtoolbar',
store: store, // same store GridPanel is using
dock: 'bottom',
displayInfo: true
}],
renderTo: Ext.getBody()
});