View Full Version : Add View and Controller Dynamically

23 Jun 2012, 5:36 AM

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

var rightPanel = me.getRightPanel();
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?


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

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