我目前有一个没有商店的表格。我想要实现的是单击该面板中的一个按钮,将该表单的数据对象存储在一个变量中。如何做到这一点?
这是我的代码:
Ext.define('Nits.view.PropertyPanelCmp', {
extend:'Ext.form.Panel',
alias : 'widget.propertypanelCmp',
id: 'propertypanelCmp',
title: 'File properties',
height: 500,
width: 200,
draggable: false,
closable: false,
//autoScroll:true,
layout: {
align: 'stretch',
type: 'vbox'
},
fieldDefaults: {
labelWidth: 65
},
bodyPadding: 10,
initComponent: function() {
var me = this;
me.items = [
{
xtype: 'fieldset',
height: 108,
title: 'Common Properties',
items: [
{
xtype: 'textfield',
fieldLabel: 'Name',
anchor: '100%'
},
{
xtype: 'textfield',
fieldLabel: 'Type',
anchor: '100%'
},
{
xtype: 'textfield',
fieldLabel: 'Age',
anchor: '100%'
}
]
},
{
xtype: 'fieldset',
title: 'Level1 Properties',
items: [
{
xtype: 'textfield',
fieldLabel: 'Sample1',
anchor: '100%'
},
{
xtype: 'checkboxfield',
fieldLabel: 'Recursive',
// boxLabel: 'Box Label',
anchor: '100%'
},
{
xtype: 'checkboxfield',
fieldLabel: 'Delete',
// boxLabel: 'Box Label',
anchor: '100%'
},
{
xtype: 'checkboxfield',
fieldLabel: 'Read Only',
// boxLabel: 'Box Label',
anchor: '100%'
},
{
xtype: 'textfield',
fieldLabel: 'Include',
anchor: '100%'
},
{
xtype: 'textfield',
fieldLabel: 'Exclude',
anchor: '100%'
}
]
},
{
xtype: 'fieldset',
title: 'Level2 Properties',
items: [
{
xtype: 'combobox',
fieldLabel: 'File B',
anchor: '100%'
}
]
},
{
xtype: 'button',
text: 'Apply',
listeners: {
click: {
fn: me.onButtonClick,
scope: me
}
}
}
];
me.callParent(arguments);
},
//Here do what you want to when click on Apply button
onButtonClick: function(button, e, options) {
alert('Sample');
}
}
);
此表单元素需要 json 对象