欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

extjs3 combobox取value和text案例詳解

 更新時(shí)間:2013年02月06日 15:00:43   作者:  
使用combobox時(shí),它有一個(gè)hiddenName的屬性,專(zhuān)門(mén)用于提交combobox中value的值,接下來(lái)介紹extjs3 combobox如何取value和text值,感興趣的朋友可以不要錯(cuò)過(guò)了啊


使用combobox時(shí),它有一個(gè)hiddenName的屬性,專(zhuān)門(mén)用于提交combobox中value的值.
現(xiàn)假設(shè)某combobox的Id為comboId,hiddenName屬性的值為hiddenValue,
那么,使用Ext.get('comboId').dom.value方法獲取的是combobox中選中項(xiàng)的文本text值,
而使用Ext.get('hiddenValue').dom.value獲取的才是combobox中需要提交的value的值。
Ext.getCmp("ID值").getValue();獲取到的是Value值
.replace(/\s/g, ""); //移除json文本中所有的換行,空格,制表符;
=========================================
extjs 執(zhí)行button的點(diǎn)擊事件,執(zhí)行handler事件
最簡(jiǎn)單的方法是查看extjs生成后的html代碼dom里面 找到對(duì)應(yīng)的生成的ID的
例如:
方法1:

復(fù)制代碼 代碼如下:

var btn = document.getElementById("ext-gen40");//這里的ext-gen40就是extjs 隨即生成的iD 但是有時(shí)候這個(gè)id會(huì)變化的,
btn.click();

方法2:
復(fù)制代碼 代碼如下:

Ext.getCmp('title2d').fireEvent("click"); //這里的 ”title2d“ 是extjs代碼中的id

執(zhí)行按鈕handler事件:
復(fù)制代碼 代碼如下:

var btn2d = Ext.getCmp("title2d");
btn2d.handler.call(btn2d.scope, btn2d);

參考網(wǎng)址:http://www.sencha.com/forum/showthread.php?25677-2.0.1-fireEvent%28-click-%29-on-buttons-don-t-call-handler-function
onClick是一個(gè)方法,而handler是一個(gè)配置項(xiàng)
extjs onclick和handler的區(qū)別:http://blog.csdn.net/21aspnet/article/details/6865571
======================================================獲取文本框的值
1、Html文本框
如:
復(fù)制代碼 代碼如下:

<input type="text" name="test" id="test" >

獲取值的方式為:
復(fù)制代碼 代碼如下:

var tValue = Ext.getDom('test').value;

或者
復(fù)制代碼 代碼如下:

var tValue = document.getElementById('test').value

2、ExtJs的組件
如:
復(fù)制代碼 代碼如下:

{
id:'test',
xtype:'textfield',
fieldLabel:'&nbsp;&nbsp;測(cè)試',
name:'test',
width:370
}

獲取值的方式為:
復(fù)制代碼 代碼如下:

var tValue = Ext.getCmp('test').getValue();
  Ext.get('test').dom.value

設(shè)置文本框的值
復(fù)制代碼 代碼如下:

Ext.getCmp('test').setValue("設(shè)置的值");

==============================按鈕的 啟用 和 禁用
復(fù)制代碼 代碼如下:

Ext.getCmp('btnQc').disable();//禁用
Ext.getCmp('btnQc').enable();//啟用

方法1:可以在定義bbar的按鈕時(shí)直接給屬性,hidden : true 屬性,可隱藏;disabled : true 屬性,可禁用 方法2:給按鈕添加id,比如id:'btn';然后在panel的事件中調(diào)用Ext.getCmp('btn').disable();禁用或Ext.getCmp('btn').enable();開(kāi)啟。Ext.getCmp('btn').setVisible (false);隱藏或Ext.getCmp('btn').setVisible (true);顯示。

相關(guān)文章

最新評(píng)論