kringla
29 Aug 2012, 7:36 AM
Hi,
First off, let me say I'm a newcomer to Ext, so I'm still struggling to get my head around how things relate to one and other.
What I want to do is to load a new view into the center region of a border layout, by clicking on a tree item (Like evil frames layouts in the old days).
I've got the tree click event part working and all that is left it to change the center region. I know that it can be done with the card xtype, but I'm rebuilding an application with around 40 views (non ext, with forms, heavy tables and graphs), and I imagine that trying to do it with card, would make the load time unbearable.
I've gotten to the stage where I can remove the contents of the center region, but I can't find a way to load a new view into it.
The following is what I currently have running in the itemclick event function in the tree controller:
var mainViewport = Ext.getCmp('mainPort');
mainViewport.layout.regions.center.ownerCt.remove('mainDiv');
mainDiv = Ext.create('Ext.panel.Panel', {
id: 'mainDiv',
xtype: 'rekvilistfull',
region: 'center'
});
mainViewport.add(mainDiv);
mainViewport.doLayout();
As you probably can tell, the id of the viewport is mainPort and the id of the center region is mainDiv. I'm sure there are better ways to load the mainDiv object, but this is the first way I found that worked. The xtype rekvilsitfull is a view that is defined in the controller, and it works if I hardcode it into the viewport.
This code loads without any errors, but it only removes the contents of the region.
So, am I way off, or close to the solution?
Or should I give up, and use card, and hope that it does some kind of dynamic background loading/off-loading that doesn't bring the browser to a halt after the user has opened allot of views?
Oh, and I have tried to find the solution in the forums and on the net, but the closest I've found to what I want is card xtype. So if there is a post about this, then I must be searching with the wrong terms.
First off, let me say I'm a newcomer to Ext, so I'm still struggling to get my head around how things relate to one and other.
What I want to do is to load a new view into the center region of a border layout, by clicking on a tree item (Like evil frames layouts in the old days).
I've got the tree click event part working and all that is left it to change the center region. I know that it can be done with the card xtype, but I'm rebuilding an application with around 40 views (non ext, with forms, heavy tables and graphs), and I imagine that trying to do it with card, would make the load time unbearable.
I've gotten to the stage where I can remove the contents of the center region, but I can't find a way to load a new view into it.
The following is what I currently have running in the itemclick event function in the tree controller:
var mainViewport = Ext.getCmp('mainPort');
mainViewport.layout.regions.center.ownerCt.remove('mainDiv');
mainDiv = Ext.create('Ext.panel.Panel', {
id: 'mainDiv',
xtype: 'rekvilistfull',
region: 'center'
});
mainViewport.add(mainDiv);
mainViewport.doLayout();
As you probably can tell, the id of the viewport is mainPort and the id of the center region is mainDiv. I'm sure there are better ways to load the mainDiv object, but this is the first way I found that worked. The xtype rekvilsitfull is a view that is defined in the controller, and it works if I hardcode it into the viewport.
This code loads without any errors, but it only removes the contents of the region.
So, am I way off, or close to the solution?
Or should I give up, and use card, and hope that it does some kind of dynamic background loading/off-loading that doesn't bring the browser to a halt after the user has opened allot of views?
Oh, and I have tried to find the solution in the forums and on the net, but the closest I've found to what I want is card xtype. So if there is a post about this, then I must be searching with the wrong terms.