나는 앱을 가지고 있으며 모든 것이 잘 렌더링됩니다. 그러나 mainTabChanged 이벤트를 catch 할 수없고 이유도 없습니다. 나는 예를 들어 콘솔 로그 FIRED
과 같은 모든 것을했으나 결코 결코 RECEIVED
입니다.Ext JS 이벤트 실행 안 함
왜?
Ext.define('MyApp.controller.Tab', {
extend:'Ext.app.Controller',
init:function() {
var me = this;
me.mainWindow = me.getView('tab.List').create();
me.control({
'mainTab': {
mainTabChanged: me.onMainTabChanged
}
});
},
me.onMainTabChanged: function(oldTab, newTab, settings) {
console.log("received");
console.log(settings);
}
});
Ext.define('MyApp.view.tab.List', {
extend:'Ext.form.FieldSet',
alias:'widget.mainTab',
initComponent:function() {
var me = this;
me.title = 'App'
me.items = me.createElements();
me.addEvents(
'mainTabChanged'
);
me.callParent(arguments);
},
createElements: function() {
var me = this, tabs = [];
tabs = [{
title: 'Tab 1',
bodyPadding: 10,
html : 'A simple tab'
},
{
title: 'Tab 2',
html : 'Another one'
}];
var tabPanel = Ext.create('Ext.tab.Panel', {
height: 150,
activeTab: 0,
plain: true,
items : tabs,
listeners: {
beforetabchange: function(panel, newTab, oldTab) {
console.log("FIRED");
me.fireEvent('mainTabChanged', oldTab, newTab, 'Test');
}
}
});
return tabPanel;
}
});
여기에 'me.onMainTabChanged : function' 구문 오류가 있습니다.'onMainTabChanged : function'으로 변경하십시오. 비록 그것이 당신의 문제인지 모르겠다. 그렇지 않다면 문제를 재현하는 데 사용할 수 있도록 jsfiddle을 준비하거나 충분한 코드를 추가하십시오. – Yoshi
그게 오류가 아니 었어. 나는 그것을 위해 jsfiddle을 모으는 법을 모른다. ext js가 다른 소프트웨어 스택 (shopware)의 일부이기 때문에 좀 더 복잡하다. 그러나 나는 시도 할 것이다. – shredding