創建的getter/setter我有我創建了一個組件代碼。在點擊申請時,我想保存這個表單域對象並使其可用於獲取。所以父容器可以讀取它。ExtJS的如何組件
我也希望所有領域的getter/setter,這樣可以更新值運行。如何實現這一目標?
Ext.define('MyApp.view.MyForm', {
extend: 'Ext.form.Panel',
height: 463,
width: 227,
bodyPadding: 10,
title: 'My Form',
initComponent: function() {
var me = this;
Ext.applyIf(me, {
items: [
{
xtype: 'textfield',
fieldLabel: 'Component Name',
anchor: '100%'
},
{
xtype: 'textfield',
fieldLabel: 'Host',
anchor: '100%'
},
{
xtype: 'textfield',
fieldLabel: 'Port',
anchor: '100%'
},
{
xtype: 'textfield',
fieldLabel: 'Path',
anchor: '100%'
},
{
xtype: 'textareafield',
fieldLabel: 'Request Data',
anchor: '100%'
},
{
xtype: 'button',
text: 'Apply',
listeners: {
click: {
fn: me.onButtonClick,
scope: me
}
}
}
]
});
me.callParent(arguments);
},
onButtonClick: function(button, e, options) {
var form = this.getForm(),
values = form.getFieldValues(),
//make this available to public
json = Ext.JSON.encode(values);
console.log(json);
}
});
任何幫助表示讚賞。 – 2012-07-24 13:28:25