ext combobox getValue

來源:互聯網
上載者:User

標籤:style   blog   http   color   使用   io   for   art   

使用combobox時,它有一個hiddenName的屬性,專門用於提交combobox中value的值. 
現假設某combobox的Id為comboId,hiddenName屬性的值為hiddenValue, 


那麼,

  1. 使用Ext.get(‘comboId‘).dom.value方法擷取的是combobox中選中項的文本text值, 
  2. 使用Ext.get(‘hiddenValue‘).dom.value擷取的才是combobox中需要提交的value的值。 
  3. Ext.getCmp("ID值").getValue();擷取到的是Value值 


.replace(/\s/g, ""); //移除json文本中所有的換行,空格,定位字元; 
========================================= 
extjs 執行button的點擊事件,執行handler事件 
最簡單的方法是查看extjs產生後的html代碼dom裡面 找到對應的產生的ID的 
例如: 
方法1: 

var btn = document.getElementById("ext-gen40");//這裡的ext-gen40就是extjs 隨即產生的iD 但是有時候這個id會變化的, btn.click(); 

 

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

 

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

參考網址:http://www.sencha.com/forum/showthread.php?25677-2.0.1-fireEvent%28-click-%29-on-buttons-don-t-call-handler-function 

onClick是一個方法,而handler是一個配置項 

extjs onclick和handler的區別:http://blog.csdn.net/21aspnet/article/details/6865571 


======================================================擷取文字框的值 
1、Html文字框 

 

如:  

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

 

擷取值的方式為: 

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

或者 

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

2、ExtJs的組件 

如:

{ id:‘test‘, xtype:‘textfield‘, fieldLabel:‘  測試‘, name:‘test‘, width:370 } 

擷取值的方式為: 

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

設定文字框的值 

Ext.getCmp(‘test‘).setValue("設定的值"); 

==============================按鈕的 啟用 和 禁用 

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

 

方法1:可以在定義bbar的按鈕時直接給屬性,

  hidden : true 屬性,可隱藏;

  disabled : true 屬性,可禁用

方法2:給按鈕添加id,比如id:‘btn‘;

  然後在panel的事件中調用Ext.getCmp(‘btn‘).disable();

  禁用或Ext.getCmp(‘btn‘).enable();開啟。Ext.getCmp(‘btn‘).setVisible (false);

  隱藏或Ext.getCmp(‘btn‘).setVisible (true);顯示。

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.