extjs分页全显了,不能出现分页,不用后台,我想模拟出来那些分页的效果

datouchao1988 2011-03-09 03:41:52
function GridBasic() {
//1. 定义表格
var cm = new Ext.grid.ColumnModel([
{ header: '编号', dataIndex: 'id',sortable:true},
{ header: '性别', dataIndex: 'sex',sortable:true},
{ header: '名称', dataIndex: 'name',width:'20',sortable:true},
{ header: '描述', dataIndex: 'desciption',width:'10',sortable:true}
]);


//2. 创建数据源
var data = [
['1','男','张三丰','是个作家'],
['2','男','石曼迪','会武功'],
['3','男','姜子牙','能捉鬼'],
['4','女','穆桂英','好像是皇帝'],
['5','男','孙悟空','高级程序员'],
['6','男','张三丰','是个作家'],
['7','男','石曼迪','会武功'],
['8','男','姜子牙','能捉鬼'],
['9','女','穆桂英','好像是皇帝'],
['10','男','孙悟空','高级程序员']
];
var ds = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(data),
reader: new Ext.data.ArrayReader({}, [
{ name: 'id' },{ name: 'sex' },{ name: 'name' },{ name: 'desciption' }
])
});



var grid = new Ext.grid.GridPanel({
el:'grid',
ds: ds,
cm: cm,
width: 500,
height: 260,
viewConfig: {
forceFit: true
},
bbar:new Ext.PagingToolbar({
pageSize:5,
store:ds,
displayInfo: true,
displayMsg: '显示第{0}条到{1}条记录,一共{2}条数据',
emptyMsg: "没有记录"
})
});
grid.render();
ds.load();


}
Ext.onReady(GridBasic); //
</script>
...全文
336 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
datouchao1988 2011-03-23
  • 打赏
  • 举报
回复
但是那个extjs必须是php我想模拟一些本地数据都不可以了,我想改变数据字段怎么办呢
KK3K2005 2011-03-21
  • 打赏
  • 举报
回复
var ds = new Ext.data.Store

重写stroe使之实现分页显示数据
datouchao1988 2011-03-21
  • 打赏
  • 举报
回复
我看了extjs 3.1的版本,当我使用jsp把它那个url改为jsp就是本地的时候不能够引用数据,如果改为http://那就可以了
prince_java 2011-03-10
  • 打赏
  • 举报
回复
{"totalCount":"65042","topics":[{"threadid":"126281","forumid":"11","forumtitle":"Ext: Premium Help","title":"trigger store function from the form","author":"alonal","lastposter":"jsakalos","lastpost":"1299715490","excerpt":"Hi\n\nWhen i write \nmyForm.getForm().updateRecord(this.record); it triggers the store to call update function. the form tirggers the update function in the store, I do not trigger it directly.\n How do i trigger create function when a new record is added from the form (i mean, what do i need to write...","replycount":"1"},...]}

这是extjs 3.3.1版本的例子,注意他的数据结构,totalCount总条数,topics信息头

这是例子中的js,你可以把proxy换成你的固定数据试试

var store = new Ext.data.JsonStore({
root: 'topics',
totalProperty: 'totalCount',
idProperty: 'threadid',
remoteSort: true,

fields: [
'title', 'forumtitle', 'forumid', 'author',
{name: 'replycount', type: 'int'},
{name: 'lastpost', mapping: 'lastpost', type: 'date', dateFormat: 'timestamp'},
'lastposter', 'excerpt'
],

// load using script tags for cross domain, if the data in on the same domain as
// this page, an HttpProxy would be better
proxy: new Ext.data.ScriptTagProxy({
url: 'http://extjs.com/forum/topics-browse-remote.php'
})
datouchao1988 2011-03-10
  • 打赏
  • 举报
回复
在ext-2.3.0\examples\locale有个例子multi-lang.html里有讲解,但是不知道哪一行是我需要的
tuo_bing 2011-03-09
  • 打赏
  • 举报
回复
extjs 没用过,但是我看你设置的属性里面是不是少了一个 paganation=true(是否分页)的设置?
然后是否还有一个 pagenow(当前显示页数) 的设置呢 ?

87,914

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧