У меня есть код, в котором я создал компонент. При нажатии кнопки Apply я хочу сохранить этот объект полей форм и сделать доступным для getter. Так что родительский контейнер может это прочитать.Extjs Как создать геттер/сеттер в компоненте
Я также хочу, чтобы все полевые геттер/сеттер, чтобы можно было обновить значение времени выполнения. Как достичь этого?
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);
}
});
Любая помощь приветствуется. –