我的ExtJS按钮单击后没有响应。现在的代码看起来像这样。
Ext.define('EDS.view.selector.Container', {
extend: 'Ext.form.Panel',
alias : 'widget.selectorcontainer',
title: 'Selector_V2',
renderTo: 'input-div',
layout: 'fit',
height: '100%',
items: [
{
xtype: 'tabpanel',
defaults: {
bodyPadding: 10
},
}
],
buttons: [
{
text: 'Reset',
handler: function(){
console.log("Reset");
this.up('form').getForm().reset();
}
},
{
text: 'Add to constrain',
handler: this.addConstrain,
}
],
/*
* Logic for button "Add to constrain"
*
* Adds an entry into the constrain list describing a person, cost center or an application
*/
addConstrain: function(button, event){
console.log('Add_to_constrain clicked');
}
});
最初这个'selectorcontainer'是直接放在我的app.js中的。但我将其提取到了一个独立的视图中。在提取之前,它能够完美地工作,但现在它不起作用了。
顺便说一下,我有两个按钮,第一个“重置”按钮正常工作。所以我想知道与作用域相关的"this.addConstrain"是否存在问题。