單擊後,我的ExtJS按鈕的處理程序不會被調用。現在代碼看起來像這樣。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」有問題。
你應該清理你的尾隨逗號,否則這將在一些瀏覽器中打破。 – Towler
好點。開發完成後我會這樣做。有沒有第三方工具? @Towler – SolessChong
我還沒有遇到過,但我也沒有看太硬。如果你找到一個,讓我知道! – Towler