mydata.json文件
{ "studies":[
{ "UserName": "李彦宏", "Sex": "男", "Age":25, "XueHao":"00001", "BanJi":"一班" },
{ "UserName": "马云", "Sex": "男", "Age":31, "XueHao":"00002", "BanJi":"二班" }]
}
grids文件
Ext.onReady(function () {
Ext.define('MyData', {
extend: 'Ext.data.Model',
fields: ['UserName', 'Sex', 'Age', 'XueHao', 'BanJi']
});
//创建数据源
var data = new Ext.data.Store({
model: 'MyData',
proxy: {
type: 'ajax',
url: 'mydata.json',
reader: {
type: 'json',
root: 'studies',
totalProperty: 'totalCount'
}
},
autoLoad: true
});
Ext.create('Ext.grid.Panel', {
store: data,
columns: [
{ text: "姓名", width: 120, dataIndex: 'UserName', sortable: true },
{ text: "性别", flex: 1, dataIndex: 'Sex', sortable: false },
{ text: "年龄", width: 100, dataIndex: 'Age', sortable: true },
{ text: "学号", width: 100, dataIndex: 'XueHao', sortable: true },
{ text: "班级", width: 100, dataIndex: 'BanJi', sortable: true }
],
height: 200,
width: 600,
x: 20,
y: 20,
title: 'ExtJS4 Grid示例',
renderTo: Ext.getBody(),
viewConfig: {
stripeRows: true
}
});
});
应该是 那个地方 Throw抛出了 没有捕获