Ext_数字输入框_Ext.form.NumberField
/*?
Ext.form.NumberField独有配置表:?
allowDecimals???????????? Boolean???????????? 是否允许输入小数(默认true)?
allowNegative???????????? Boolean???????????? 是否允许输入负数(默认true)?
baseChars???????????????? String????????????? 输入有效数字集合,默认为'0123456789'?
decimalPrecision????????? Number????????????? 输入数字精度(默认保留小数点后2位)?
decimalSeparator????????? String????????????? 十进制分隔符(默认'.')?
maxValue????????????????? Number????????????? 允许输入最大数值?
maxText?????????????????? String????????????? 最大值验证失败错误提示信息?
minValue????????????????? Number????????????? 允许输入最小值?
minText?????????????????? String????????????? 最小值验证失败错误提示信息?
nanText?????????????????? String????????????? 无效数据错误提示信息?
*/?
?
Ext.onReady(function(){??
??? Ext.BLANK_IMAGE_URL = '../extjs2.0/resources/images/default/s.gif';??
??????
??? Ext.QuickTips.init();??
??????
??? Ext.form.Field.prototype.msgTarget = 'side';??
??????
??? var config = {??
??????? title:'Ext.form.NumberField示例',??
??????? labelSeparator:':',??
??????? labelWidth:80,??
??????? bodyStyle:'padding:5 5 5 5',??
??????? frame:true,??
??????? height:150,??
??????? width:250,??
??????? renderTo:'form',??
??????? items:[??
??????????? new Ext.form.NumberField({??
??????????????? fieldLabel:'整数',??
??????????????? allowDecimals:false,?????????????? //不允许输入小数??
??????????????? nanText:'请输入有效整数',?????????? //无效数字提示??
??????????????? allowNegative:false??????????????? //不允许输入负数??
??????????? }),??
??????????? new Ext.form.NumberField({??
??????????????? fieldLabel:'小数',??
??????????????? decimalPrecision:2,???????????????? //精确到小数点后2位(执行4舍5入)??
??????????????? allowDecimals:true,??????????????? //允许输入小数??
??????????????? nanText:'请输入有效小数',??
??????????????? allowNegative:false?
??????????? }),??
??????????? new Ext.form.NumberField({??
??????????????? fieldLabel:'数字限制',??
??????????????? nanText:'请输入有效数字',??
??????????????? baseChars:'12345'?????????????????? //输入数字范围??
??????????? }),??
??????????? new Ext.form.NumberField({??
??????????????? fieldLabel:'数字限制',??
??????????????? maxValue:100,?????????????????????? //最大值??
??????????????? maxText:'值太大',??
??????????????? minValue:50,??????????????????????? //最小值??
??????????????? minText:'值太小'?
??????????? })??
??????? ]??
??? }??
??????
??? var form = new Ext.form.FormPanel(config);??
});
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/lulu_jiang/archive/2010/04/11/5473200.aspx