现在的位置: 首页 > 综合 > 正文

Extjs 表单输入控件显示以及赋值获取值

2013年09月27日 ⁄ 综合 ⁄ 共 1967字 ⁄ 字号 评论关闭

文本类控件 继承自Field==>BoxComponent==>Component==>Observable

{

fieldLabel:'A',

name:'Name',

ID:'FullName',

allowBlank:'alse,

blankText:'不允许为空',

width:120,

value:'sos',

hidden:Boolean,

hideLabel:Boolean,

labelSeparator:'~',

regex:

regexText:' 不允许输入...',

listeners:{

'change':function(){

//文本框中内容发生变话时执行事件

},

'focus':function(){

//聚焦于文本框时执行的事件

},

'show':function(){

//调用show方法显示组件之后触发

},

'beforeshow':function()

{

//在调用show()方法显示组件之前触发,事件处理函数返回false可以停止show

}

}

}

-----------日期型控件

{

xtype:'datefield',

id:'唯一',

format:'Y-m-d',

name:'名称',

allowBlank:Boolean,

blankText:'',

width:125,

fieldLabel:'日期',

value:newdate

 

}

//---------------------------隐藏域控件

{

xtype:'hidden',

value:''

}

----------下拉列表控件

// 远程读取资料

var  Sos = new Ext.data.Store({
        proxy: new Ext.data.HttpProxy({
            url:'../AjaxHandler/CompanyPriceHandler.aspx?Action=GetComPriceClass&PriceDate='+ new Date().format('Ymd')
        }),
        reader: new Ext.data.JsonReader({
            id: 'MD001'
        },
               manufileds),
        remoteSort: true,
        autoLoad: true

    });

 

{

xtype:'combo',

name:'transtype',

store:sos,

typeAhead:Boolean,//设置为true ,则当开始输入字符时,在指定的延迟之后会自动匹配剩下的内容,如果找到了匹配的内容则自动选中它

typeAheadDelay:Number://在键入文本时被显示之前要等待的毫秒数

fieldLabel:'a',

hiddenName:'s',

triggerAction:Boolean,

forceSelection:true,

emptyText:'',

selectOnFocus:true,

width:'',

editable:Boolean,

allowBlank:false,

blankText:'',

dispalyField:'',

valueField:'',

listeners:{

'select':function(){

//combox 选中项时激发该事件

}

}

}

获取文本框中的值

formname.getForm().findField('Fieldname').getValue();

Ext.getCmp(‘控件ID’).dom.value();

var coll=this.ownerCt.items;//访问容器组件

var temp="";

temp+=coll.first().getValue();

temp+=coll.itemAt(1).getValue();

formname.findByType('type')[index].getValue/setValue();

formname.findByType('type')[index].getEl().dom.src="设置路径";

 

combox : Ext.getCmp("ID").getRawValue();// 获取Text值

                Ext.get("ID").dom.value;//获取到输入的text值

                Ext.getCmp("ID").dom.value();//获取的是text值

                Ext.getCmp("hiddenName").dom.value();//获取的是value值

datefield:Ext.getCmp("ID").getValue().format('Ymd');

 

抱歉!评论已关闭.