87,991
社区成员
发帖
与我相关
我的任务
分享
<div id="hello"></div>
<div id="element"></div>
Ext.onReady(function () {
var store = new Ext.data.JsonStore({
url: "http://localhost/getData.ashx?method=try&random=0.9640254709105345",
autoload:true,
root: "results",
fields:["id","name","sex","email",name:"bornDate",type:"date",dateFormat:"Y-n-j"}]
});
document.getElementById("element").innerHTML = "<select id='sexList'><option>男</option><option>女</option></select>";
var colM = new Ext.grid.ColumnModel([{
header: "姓名",
dataIndex: "name",
sortable: true,
editor: new Ext.form.TextField()
},
{ header: "性别",
dataIndex: "sex",
editor: new Ext.form.ComboBox({ transform: "sexList", //select元素id
triggerAction: 'all',
lazyRender: true
})
},
{ header: "出生日期",
dataIndex: "bornDate",
width: 120,
renderer: Ext.util.Format.dateRenderer('Y年m月d日'),
editor: new Ext.form.DateField({ format: 'Y年m月d日' })
},
{ header: "电子邮件",
dataIndex: "email",
sortable: true,
editor: new Ext.form.TextField()
}
]);
var grid = new Ext.grid.EditorGridPanel({
renderTo: "hello",
title: "学生基本信息管理",
height: 200,
width: 600,
cm: colM,
store: store,
autoExpandColumn: 3,
clicksToEdit: 1
});
});
{results:[{id:1,name:'小王',email:'xiaowang@easyjf.com',sex:'男',bornDate:'1991-4-4'},{id:1,name:'小李',email:'xiaoli@easyjf.com',sex:'男',bornDate:'1992-5-6'},{id:1,name:'小兰',email:'xiaoxiao@easyjf.com',sex:'女',bornDate:'1993-3-7'}] }