//最高学历 //准备数据 var data = [ [1,"博士"], [2,"硕士"], [3,"研究生"], [4,"本科"], [5,"专科"], [6,"高中"], [7,"文盲"] ]; var proxy = new Ext.data.MemoryProxy(data); //定义学历结构 var edu = new Ext.data.Record.create([ {name:"eid", type: "int", mapping: 0}, {name:"ename", type: "string", mapping: 1} ]); var reader = new Ext.data.ArrayReader({},edu); var store = new Ext.data.Store({ proxy: proxy, reader: reader }); //加载数据 store.load(); var chkEdu = new Ext.form.ComboBox({ name: "chkEdu", fieldLabel: "最高学历", store: store, mode: "local", triggerAction: "all", emptyText: "请选择最高学历", displayField: "ename", valueField:"eid", value: 3 //缺省值 }); var numLove = new Ext.form.NumberField({ name: "numLove", fieldLabel: "最喜欢的数字" }); var areaAddress = new Ext.form.TextArea({ name: "areaAddress", fieldLabel: "家庭住址", width: 500, height: 50 }); var timeWork = new Ext.form.TimeField({ name: "timeWork", fieldLabel: "上班时间", increment: 30, fommat: "H:i" }); /* * json对象 * var timeWork = { name: "timeWork", xtype: "timefield", fieldLabel: "上班时间" }*/ //个人简介 var htmlIntro = new Ext.form.HtmlEditor({ name: "htmlIntro", fieldLabel: "个人简介", // enableLists: false, // enableSourceEdit: false, height: 150 }); var txtPhoto = new Ext.form.TextField({ name: "txtPhoto", inputType: "file", fieldLabel: "照片", width: 500 }); var btnSubmit = new Ext.Button({ text: "提交", handler: function(){ f.getForm().submit({ success: function(form, action){ form.items.each(function(field){ if(field.isFormField){ alert(field.getName() + "=" + field.getValue()); } }); }, failure: function(){ Ext.MessageBox.alert("","表单提交失败!"); } }); } }); var btnReset = new Ext.Button({ text: "重置", handler: function(){ f.getForm().reset(); } });
Ext学习_表单组件5
最新推荐文章于 2011-08-26 16:27:50 发布