lundi 5 mai 2014

ViewController Methods Not Accessible In The View

I have a View like this:

Code:



Ext.define('App.view.foo.Foo', {
extend: 'Ext.panel.Panel',
xtype: 'foo',
controller: 'foo',
items: [{
xtype: 'button',
text: 'Click Me',
listeners: {
click: 'onClick'
}
}],
listeners: {
afterrender: 'onRender'
}
});

And corresponding ViewController like this:

Code:



Ext.define('App.view.foo.FooController', {
extend: 'Ext.app.ViewController',


alias: 'controller.foo',
onClick: function() {
console.log('My button was clicked!');
},
onRender: function(row, rec) {
console.log('I am rendered!');
}
});

It gives me following error:

Code:



Uncaught Error: Unable to dynamically resolve method "onRender"

If I comment out "afterrender" listener, it works fine for "click" listener which is attached to a child item of the panel. Am I doing something wrong here? Any help will be greatly appreciated. Thanks.


Aucun commentaire:

Enregistrer un commentaire