Ext3.4-Gridpanel
Ext.onReady(function () { var cm = new Ext.grid.ColumnModel([{ header: "id", dataIndex: "id" }, { header: "name", dataIndex: "name" }, { header: "score", dataIndex: "score"}]); var data = [['1', 'lilei', 90], ['2', 'hanmeimei', 100], ['3', 'john', 95] ] var store = new Ext.data.Store({ //Ext.data.Store创建一个存储对象,store负责把各种各样的数据(array,json)转换成Ext.data.Record proxy: new Ext.data.MemoryProxy(data), //定义代理 reader: new Ext.data.ArrayReader({}, [ //Ext.data.ArrayReader用来解析数组 {name: 'id' }, //这里可以使用mapping来指定数据的位置,如果想把数组中的第2个元素映射成id,mapping:1 {name: 'name' }, { name: 'store' } ]) }); store.load(); var grid = new Ext.grid.GridPanel({ height:500, renderTo: Ext.getBody(), store: store, cm:cm }) })