/* var data=[{id:1, name:' 小王 ', email:'[email protected]', sex:' 男 ', bornDate:'1991-4-4'}, {id:1, name:' 小李 ', email:'[email protected]', sex:' 男 ', bornDate:'1992-5-6'}, {id:1, name:' 小兰 ', email:'[email protected]', sex:' 女 ', bornDate:'1993-3-7'}]; */ var reader =new Ext.data.JsonStore({ id:'id', //data:data,这里是用来本地测试调用 root:'results', mode: 'local', url:'http://localhost:99/ext2.0/js/txt/grid.php',//返回的json数据 autoLoad: true, fields:["id","name","sex","email",{name:"bornDate",type:"date",dateFormat:"Y-n-j"}] }); reader.load(); //alert(reader.getCount); var colM=new Ext.grid.ColumnModel([{ header:" 姓名 ", dataIndex:"name", sortable:true, editor:new Ext.form.TextField()}, {header:" 性别 ", dataIndex:"sex", sortable:true, editor:new Ext.form.ComboBox({//transform:'sexlist', displayField:'sex', triggerAction: 'all', mode: 'local', store:sex,//store editable:false, lazyRender:true}) }, { header:" 出生日期 ", dataIndex:"bornDate", width:120, sortable:true, editor : new Ext.form.DateField(), renderer:Ext.util.Format.dateRenderer('Y 年 m 月 d 日 ')}, {header:" 电子邮件 ", dataIndex:"email", sortable:true, editor:new Ext.form.TextField()} ]); var grid = new Ext.grid.EditorGridPanel({ renderTo:"grid", title:" 学生基本信息管理 ", cm:colM, store:reader, autoHeight: true, autoExpandColumn:3 });