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

ExtJs 一些常用的控件的创建及属性详解

NumberField控件?
整数,小数,数字限制,值范围限制?
??????????? new Ext.form.NumberField({?
??????????????? fieldLabel:'整数',?
??????????????? allowDecimals : false,//不允许输入小数?
??????????????? allowNegative : false,//不允许输入负数?
??????????????? nanText :'请输入有效的整数',//无效数字提示?
??????????? }),?
??????????? new Ext.form.NumberField({?
??????????????? fieldLabel:'小数',?
??????????????? decimalPrecision : 2,//精确到小数点后两位?
??????????????? allowDecimals : true,//允许输入小数?
??????????????? nanText :'请输入有效的小数',//无效数字提示?
??????????????? allowNegative :false//允许输入负数?
??????????? }),?
??????????? new Ext.form.NumberField({?
??????????????? fieldLabel:'数字限制',?
??????????????? baseChars :'12345'//输入数字范围?
??????????? }),?
??????????? new Ext.form.NumberField({?
??????????????? fieldLabel:'数值限制',?
??????????????? maxValue : 100,//最大值?
??????????????? minValue : 50//最小值?
??????????? })?
TextArea 控件?
Radio或Checkbox用法? box类?
??????????? new Ext.form.Radio({?
??????????????? name : 'sex',//名字相同的单选框会作为一组?
??????????????? fieldLabel:'性别',?
??????????????? boxLabel : '男'?
??????????? }),?
??????????? new Ext.form.Radio({?
??????????????? name : 'sex',//名字相同的单选框会作为一组?
??????????????? fieldLabel:'性别',?
??????????????? boxLabel : '女'?
??????????? }),?
???????????????????? 在一排?
??????????? new Ext.form.Radio({?
??????????????? name : 'sex',//名字相同的单选框会作为一组?
??????????????? itemCls:'float-left',//向左浮动?
??????????????? clearCls:'allow-float',//允许浮动?
??????????????? fieldLabel:'性别',?
??????????????? boxLabel : '男'?
??????????? }),?
??????????? new Ext.form.Radio({?
??????????????? name : 'sex',//名字相同的单选框会作为一组?
??????????????? clearCls:'stop-float',//阻止浮动?
??????????????? hideLabel:true, //横排后隐藏标签?
??????????????? boxLabel : '女'?
??????????? }),?
??????????? new Ext.form.Checkbox({?
??????????????? name : 'swim',?
??????????????? fieldLabel:'爱好',?
??????????????? boxLabel : '游泳'?
??????????? }),?
??????????????????? 在一排?
??????????? new Ext.form.Checkbox({?
??????????????? name : 'swim',?
??????????????? itemCls:'float-left',//向左浮动?
??????????????? clearCls:'allow-float',//允许浮动?
??????????????? fieldLabel:'爱好',?
??????????????? boxLabel : '游泳'?
??????????? }),?
??????????? new Ext.form.Checkbox({?
??????????????? name : 'walk',?
??????????????? clearCls:'stop-float',//允许浮动?
??????????????? hideLabel:true, //横排后隐藏标签?
??????????????? boxLabel : '散步'?
??????????? })?
TriggerField (很像一个默认combobox)?
??????????? new Ext.form.TriggerField({?
??????????????? id:'memo',?
??????????????? fieldLabel:'触发字段',?
??????????????? hideTrigger : false,?
??????????????? onTriggerClick : function(e){?
??????????????? }?
??????????? })?
combobox下拉菜单控件?
?? 1.本地模式?
??????? 本地数据源:?
??????? 数据源的定义:?
??????? var store = new Ext.data.SimpleStore({//定义组合框中显示的数据源?
??????????? fields: ['province', 'post'],?
??????????? data : [['北京','100000'],['通县','101100'],['昌平','102200'],?
??????????????????? ['大兴','102600'],['密云','101500'],['延庆','102100'],?
??????????????????? ['顺义','101300'],['怀柔','101400']]?
??????? });?
??????????? new Ext.form.ComboBox({?
??????????????? id:'post',?
??????????????? fieldLabel:'邮政编码',?
??????????????? triggerAction: 'all',//单击触发按钮显示全部数据?
??????????????? store : store,//设置数据源?
??????????????? displayField:'province',//定义要显示的字段?
??????????????? valueField:'post',//定义值字段?
??????????????? mode: 'local',//本地模式?
??????????????? forceSelection : true,//要求输入值必须在列表中存在?