PDA

View Full Version : Add View and Controller Dynamically



oscmejia
23 Jun 2012, 5:36 AM
Hi,

I'm using this code to add a view based on user interaction:

var rightPanel = me.getRightPanel();
rightPanel.removeAll();
rightPanel.add( Ext.widget('DetailsList') );

I have created a controller that is linked to this view, but once I add the view, the controller doesn't recognize the view. I have some references defined and I'm listening for some events and they dont work.

I've tried to check if the container has been loaded, by using:

var controller = this.getController('DetailsListController');

What would be the best way to handle this? I think remove both view and controller based on user interaction and then when I need the view again, create both?? how can accomplish that?

Thanks

mitchellsimoens
6 Jul 2012, 2:02 PM
Your controllers should be loaded up front in Ext.application

jay@moduscreate.com
10 Jul 2012, 1:28 PM
I agree with Mitchell. Also, move away from Ext.widget, and use Ext.create.