Extjs怎么用Grid显示Json数据?帮我看下这个代码错在哪里。

shidabbs shidabbs 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

Ext.onReady(function(){
var itemsPerPage = 2;//指定分页大小

var store = Ext.create('Ext.data.Store', {
autoLoad: {start: 0, limit: itemsPerPage},
fields:['id', 'title', 'detail'],
pageSize: itemsPerPage, //设置分页大小
proxy: {
type: 'ajax',
url: 'http://demo/Book/list.txt', //请求的服务器地址
reader: {
type: 'json',
root: 'rows',
totalProperty: 'results'
}
}
});
//创建Grid表格组件
Ext.create('Ext.grid.Panel',{
title : 'Ext.toolbar.Paging示例',
renderTo: Ext.getBody(),
width:400,
height:150,
frame:true,
store: store,
columns: [//配置表格列
{text: "类型编号", width: 80, dataIndex: 'id', sortable: true},
{text: "类型名称", width: 180, dataIndex: 'title', sortable: true},
{text: "类型说明", width: 280, dataIndex: 'detail', sortable: true}
],
bbar: [{
xtype: 'pagingtoolbar',
store: store, //这里需要指定与表格相同的store
displayInfo: true
}]
});
});


运行结果,表格显示出来了,但是没有加载任何数据。
...全文

相关推荐

评论 2
收藏 已收藏
分享
返回顶部
shidabbs
JavaScript 87,984 成员 224,681 内容