我想在单击按钮时重定向/弹出表单 我将按钮处理程序命名为OnRoutesClick 但我遇到了一些错误
请帮助我找出错误 预先感谢您screenshot of error in browser
reportMenuController.js
Ext.define('Traccar.view.reportMenuController', {
extend:'Ext.app.ViewController',
alias:'controller.reportMenu',
requires:[
'Traccar.view.dialog.Server',
'Traccar.view.dialog.User',
'Traccar.view.dialog.reportBox'
],
onRoutesClick: function () {
var dialog = Ext.create('Traccar.view.dialog.reportBox', {
selfEdit: true
});
dialog.down('form').loadRecord(Traccar.app.getUser());
dialog.lookupReference('testNotificationButton').setHidden(false);
dialog.show();
},
reportBox.js
Ext.define('Traccar.view.dialog.reportBox', {
extend:'Traccar.view.dialog.BaseEdit',
requires: [
'Traccar.view.ClearableComboBox',
'Traccar.view.dialog.reportBoxController',
'Traccar.view.UnescapedTextField'
],
controller:'reportBox',
title:'Report',
text:'Report',
items:{
xtype:'form',
items: [{
xtype:'fieldset',
title:Strings.sharedRequired,
items:[{
xtype:'unescapedTextField',
fieldLabel:'name'
}]
}]
}
});
浏览器错误
Uncaught TypeError: controller.setView is not a function
at constructor.applyController (ext-all-debug.js:53043)
at constructor.setter [as setController] (ext-all-debug.js:10545)
at Ext.Configurator.configure (ext-all-debug.js:11134)
at constructor.initConfig (ext-all-debug.js:12643)
at constructor (ext-all-debug.js:66310)
at new constructor (ext-all-debug.js:13136)
at eval (eval at getInstantiator (ext-all-debug.js:15045), <anonymous>:3:8)
at Object.create (ext-all-debug.js:15489)
at constructor.onRoutesClick (reportMenuController.js:50)
at Object.callback (ext-all-debug.js:8705)
答案 0 :(得分:0)
Ext.define('Traccar.view.dialog.reportBox', {
extend:'Traccar.view.dialog.BaseEdit',
requires: [
'Traccar.view.ClearableComboBox',
'Traccar.view.dialog.reportBoxController',
'Traccar.view.UnescapedTextField'
],
controller:'reportMenu',
title:'Report',
text:'Report',
items:{
xtype:'form',
items: [{
xtype:'fieldset',
title:Strings.sharedRequired,
items:[{
xtype:'unescapedTextField',
fieldLabel:'name'
}]
}]
}
});