XTemplate
에는 이벤트가 내장되어 있지 않으므로 직접적인 참조를 찾을 수 없지만 약간 좋은 방법이 있습니다. 보기에
는
를 사용하여 응용 프로그램 dispatch method
을 의미하는 방법을
initialize: function() {
this.element.on({
tap: function(e, dom) {
var el = Ext.get(e.target),
elParent = Ext.get(e.parent),
fireEvent;
window.jobAction = this;
window.jobEl = el;
if (el.hasCls('job-start') || el.parent().hasCls('job-start')) {
fireEvent = 'start';
} else if (el.hasCls('job-hold') || el.parent().hasCls('job-hold')) {
fireEvent = 'hold';
} else if (el.hasCls('job-report') || el.parent().hasCls('job-report')) {
Ext.Viewport.setMasked({ xtype: 'loadmask' });
var teamId = APPNAME.currentItem.data.teamId;
var jobId = APPNAME.currentItem.data.jobId;
APPNAME.app.dispatch({controller: 'Jobs', action: 'displayReportChooser', args:[teamId,'job',jobId]})
}
if (fireEvent) {
Ext.Viewport.setMasked({ xtype: 'loadmask' });
this.fireEvent(fireEvent, Alloy.currentJob, el);
}
},
delegate: '.job-info',
scope: this
});
}
초기화합니다. 그것은 훨씬 쉬워 질 것이며 컨트롤러 내부에서 작업을 구성하는 데 도움이 될 것입니다.
http://docs.sencha.com/touch/2-0/#!/api/Ext.app.Application-method-dispatch