admin管理员组文章数量:1379528
I am trying to get this to work in sencha fiddle. If I run it I see this error in the console log "Uncaught TypeError: controller.setView is not a function". It works only if I remove the controller declaration from the view. What am i doing wrong?
Ext.define('MyApp.controller.Whatever', {
extend: 'Ext.app.Controller',
alias: 'controller.Whatever',
init: function() {
alert("Yes!");
}
});
Ext.define('MyApp.view.Whatever', {
extend: 'Ext.form.Panel',
controller: 'Whatever',
title: 'Hello',
width: 200,
html: '<p>World!</p>',
renderTo: Ext.getBody()
});
Ext.application({
name: 'MyApp',
launch: function() {
Ext.create('MyApp.view.Whatever');
}
});
Based on the answer below this worked
Ext.define('MyApp.controller.Whatever', {
extend: 'Ext.app.ViewController',
alias: 'controller.Whatever',
init: function() {
alert("Yes!");
}
});
Ext.define('MyApp.view.Whatever', {
extend: 'Ext.form.Panel',
alias:'widget.Whatever',
controller: 'Whatever',
title: 'Hello',
width: 200,
html: '<p>World!</p>',
renderTo: Ext.getBody()
});
Ext.application({
name: 'MyApp',
launch: function() {
Ext.create('MyApp.view.Whatever');
}
});
I am trying to get this to work in sencha fiddle. If I run it I see this error in the console log "Uncaught TypeError: controller.setView is not a function". It works only if I remove the controller declaration from the view. What am i doing wrong?
Ext.define('MyApp.controller.Whatever', {
extend: 'Ext.app.Controller',
alias: 'controller.Whatever',
init: function() {
alert("Yes!");
}
});
Ext.define('MyApp.view.Whatever', {
extend: 'Ext.form.Panel',
controller: 'Whatever',
title: 'Hello',
width: 200,
html: '<p>World!</p>',
renderTo: Ext.getBody()
});
Ext.application({
name: 'MyApp',
launch: function() {
Ext.create('MyApp.view.Whatever');
}
});
Based on the answer below this worked
Ext.define('MyApp.controller.Whatever', {
extend: 'Ext.app.ViewController',
alias: 'controller.Whatever',
init: function() {
alert("Yes!");
}
});
Ext.define('MyApp.view.Whatever', {
extend: 'Ext.form.Panel',
alias:'widget.Whatever',
controller: 'Whatever',
title: 'Hello',
width: 200,
html: '<p>World!</p>',
renderTo: Ext.getBody()
});
Ext.application({
name: 'MyApp',
launch: function() {
Ext.create('MyApp.view.Whatever');
}
});
Share
Improve this question
edited Dec 8, 2017 at 12:30
Lorenz Meyer
20k23 gold badges83 silver badges128 bronze badges
asked Aug 21, 2015 at 20:40
developer747developer747
16k28 gold badges104 silver badges156 bronze badges
1 Answer
Reset to default 9I think you are using Ext JS 5 or above version so use this.
Ext.app.ViewController instead of Ext.app.Controller.
本文标签: javascriptEXTjs Uncaught TypeError controllersetView is not a functionStack Overflow
版权声明:本文标题:javascript - EXTjs: Uncaught TypeError: controller.setView is not a function - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744439843a2606370.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论