日期:2014-05-16  浏览次数:20475 次

新手照着例子写的extjs的GridPanel出现的问题
JScript code

Ext.onReady(function(){
                    var cm = new Ext.grid.ColumnModel([
                        {header:"姓名",width:80,dataIndex:"Name",tooltip:"您的姓名"},
                        {header:"性别",width:40,dataIndex:"Sex",align:"center"},
                        {header:"生日",width:150,dataIndex:"Birthday",format:"Y-m-d"},
                        {header:"学历",width:80,dataIndex:"Education",align:"center"},
                        {id:"memo",header:"备注",dataIndex:"Memo"}
                    ]);
                    var data = [
                        {name:"jay",sex:"男",brithday:Date.parseDate("1979-04-11","Y-m-d"),edu:"本科",memo:"无备注"},
                        {name:"join",sex:"女",brithday:Date.parseDate("1981-02-13","Y-m-d"),edu:"本科",memo:"菜"},
                        {name: "ajax",sex: "女",birthday: Date.parseDate("1980-05-12","Y-m-d"),edu: "本科",memo: "无备注"},
                        {name: "flex",sex: "男",birthday: Date.parseDate("1980-12-11","Y-m-d"),edu: "本科",memo: "呵呵"}
                    ];
                var proxy = new Ext.data.MemoryProxy(data);
                
                var Human = Ext.data.Record.create(
                    {name:"Name",type:"string",mapping:"name"},
                    {name:"Sex",type:"string",mapping:"sex"},
                    {name:"Birthday",type:"string",mapping:"bitthday"},
                    {name:"Education",type:"string",mapping:"edu"},
                    {name: "Memo", type: "string", mapping: "memo"}
                );
                
                var reader = new Ext.data.JsonReader({},Human);
                
                var store = new Ext.data.Store({
                    proxy:proxy,
                    reader:reader
                });    
                store.load();
                
                var grid = new Ext.grid.GridPanel(
                    {
                        title:"Grid",
                        width:600,
                        autoHeight:true,
                        cm:cm,
                        store:store,
                        renderTo:Ext.getBody(),
                        autoExpandColumn:"memo"
                    }
                );            
                    
                
                
                });



照着例子写的,但是数据源出不来,只是一个空的表格,求高手指教那出错了,在线等。


------解决方案--------------------
extjs引入路径正确吗?

firebug下看看 报什么错。
------解决方案--------------------
Ext.create('Ext.data.Store', {
storeId:'simpsonsStore',
fields:['name', 'email', 'phone'],
data:{'items':[
{ 'name': 'Lisa', "email":"lisa@simpsons.com", "phone":"555-111-1224" },
{ 'name': 'Bart', "email":"bart@simpsons.com", "phone":"555-222-1234" },
{ 'name': 'Homer', "email":"home@simpsons.com", "phone":"555-222-1244" },
{ 'name': 'Marge', "email":"marge@simpsons.com", "phone":"555-222-1254" }
]},
proxy: {
type: 'memory',
reader: {
type: 'json',