【发布时间】:2013-06-14 19:44:08
【问题描述】:
我是 ExtJS 的新手。 我遵循了一个旨在在网格上创建分页的教程。 代码很简单,我发现它很可疑...... 结果,分页工具栏在那里,但在第一次加载时仍然显示所有数据。 这是我在视图文件中的代码:
Ext.define('AM.view.user.List' ,{
extend: 'Ext.grid.GridPanel',
alias: 'widget.userlist',
cls: 'overall',
title: 'xxx <img src="ressource/image/xxx.png" class="title-icon" style= "width: 5%; height: 5%; vertical-align:middle; margin-bottom:0px;" />',
columnLines: true,
dockedItems: [{
xtype: 'pagingtoolbar',
store: 'Users',
pageSize: 2,
dock: 'bottom',
displayInfo: true
}],
我还看到了带有 var 的教程,但我不知道在哪里实现它。 很抱歉,我知道那里有很多关于它的教程,但我正在努力学习它:(,我对 JS 的掌握不够!
提前致谢^_^
编辑: 我的商店文件中的代码:
var itemsPerPage = 2;
var store = Ext.define('AM.store.Users', {
pageSize: itemsPerPage,
extend: 'Ext.data.Store',
model: 'AM.model.User',
proxy: {
type: 'ajax',
api: {
read: 'application/data/users.json',
update: 'application/data/updateUsers.json',
},
reader: {
type: 'json',
root: 'users',
idProperty: 'POC',
successProperty: 'success',
totalProperty : 'total'
}
},
autoLoad: false,
});
store.load({
params:{
start:0,
limit: itemsPerPage
}
});
这告诉我:Uncaught TypeError: Object function constructor() { ... has no method 'load'
我尝试删除store.load,并在AutoLoad之后添加{start:0,limit:2},根据http://www.objis.com/formationextjs/lib/extjs-4.0.0/docs/api/Ext.toolbar.Paging.html
使用这种方法,工具栏会按原样显示“2-13 数据显示”,但网格中没有显示数据:'(.
【问题讨论】:
-
您需要一个缓冲存储来进行分页。您可以将用户商店的代码添加到您的问题中吗?
标签: extjs grid pagination paging