我在ext js中定義了自定義表單字段。
自定義字段只包含一個按鈕(此按鈕可以是事件的一些文本或圖像,無論)。
我想強制我的價值。所以我設置getValue
返回一些字符串。
該方法未被調用。
我想要發生2件事。
1. getValue
將是在提交中發送的值。
2. setValue
會給我form.load(...)
已加載的數據,我會處理我的路......Extjs使用getValue和setValue定義自定義字段
這裏有一個例子,點擊提交,你會看到getValue
沒有蜜蜂叫。 http://jsfiddle.net/RB9Hp/
或這更現實生活中的用例:http://jsfiddle.net/FTV3R/ < - 這並不會的getValue
Ext.define('Ext.form.CustomField', {
extend: 'Ext.form.FieldContainer',
alias: 'widget.customfield',
width: 300,
constructor: function(config) {
this.callParent([config]);
},
getValue : function(){
console.log("getValue");
return "test"; // I want to force new value.
},
setValue : function(val){},
initComponent: function() {
this.items = ([{'xtype' : 'button',text : 'some button'}]);
this.callParent();
}
});
可能重複[?如何創建自定義的ExtJS表單字段部件(http://stackoverflow.com/questions/6153362/how-to-create-定製ExtJS的外形場分量) –