PDA

View Full Version : Add listeners in formPanel using controller.



rhytha268
19 Jun 2013, 6:12 AM
Hi,

I used below code to add listener in controller for Store -

this.getStore('mystore').addListener('load', this.myfunction, this);

Now i tried same code to create listeners for formPanel -

this.getView('myview').addListener('render', this.myfunction, this);

It doesn't work..

Any idea ? please share

chamacs
19 Jun 2013, 11:27 AM
in the init() method, use:


this.control({
'myview': {
render: this.myfunction
}
});

rhytha268
19 Jun 2013, 10:22 PM
Hi,

Thanks for your reply.

As we know this is common way to control view in controller.

I want to add listener in myview using controller.

My question is -> how to add listeners in myview using controller?.

this.control({ 'myview': { render: this.myfunction } });

chamacs
20 Jun 2013, 1:29 PM
You want to add a listeners attribute in the View class that references a function in a Controller class?
Assuming yes.....

I don't see a clean way of doing this, if at all. Views aren't supposed to be aware of their controllers. I also don't see the purpose of doing this. All event registering and processing should be started in the Controller class.

Sorry I can't help.