View Full Version : How to change initial view that appears on a viewport

4 Jan 2013, 12:43 AM
Could anyone tell me how to change the initial view that appears on a viewport please?

4 Jan 2013, 7:40 AM
Are you saying that you want to swap out the contents of the center region of the Viewport with a different component?

4 Jan 2013, 8:12 AM

what Im saying is, when we use sencha architect, we have the option initialview, then we have a checkbox, sencha architect does it automatically for us. for example, i have a viewport, then i want to create a formpanel, i want to separate my formpanel from my viewport when designing, later i will link it. i want to have the formpanel as initial view, i just check the initialview property that sencha architect provides..i wanted to know how we do it manually,using codes. :)

4 Jan 2013, 10:07 AM
You can do something like this:

// get a reference to the Viewport.
var viewPort = Ext.ComponentQuery.query('viewport')[0];

// get a reference to the panel acting as the 'center' region of the Viewport.
var centerRegion = viewPort.down('panel[region="center"]');

// add something to the center panel.
xtype: 'someWidget'