標籤:style blog http color 使用 io for art
使用combobox時,它有一個hiddenName的屬性,專門用於提交combobox中value的值.
現假設某combobox的Id為comboId,hiddenName屬性的值為hiddenValue,
那麼,
- 使用Ext.get(‘comboId‘).dom.value方法擷取的是combobox中選中項的文本text值,
- 使用Ext.get(‘hiddenValue‘).dom.value擷取的才是combobox中需要提交的value的值。
- 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);顯示。