日期:2014-05-16 浏览次数:20475 次
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" } ); });