View Full Version : Ext.ViewPort - extend

7 Dec 2009, 3:14 AM

i'd like to extend the viewport to allow me to add different panels to it before it gets built and rendered.

this is because the app i am creating actually houses a variable amount of 'sub apps' and i'd like to build up the UI depending on which app it is we're accessing at the time.

i was hoping to have a base viewport which inside the init did something like:

initComponent: function () {

var regions = new Array();

if (this.centerRegion) {

if (this.northRegion) {

if (this.westRegion) {

var config = {
id: 'VIEW_PORT',
layout: 'border',
items: regions

Ext.applyIf(this, Ext.apply(this.initialConfig, config));
Base.ViewPort.superclass.initComponent.call(this, arguments);


and then in the inherited classes - actually have the req regions. then i could load the correct inherited viewport inside a loader based on a switch.

is this possible? where is best to add regions before the viewport is created? i understand i can't add to it once it's created but i'm trying to do this before it's intitiated.


7 Dec 2009, 4:53 AM
You can already add to it.

It is a Container.

7 Dec 2009, 5:03 AM
well, what i posted doesn't seem to work. so...

7 Dec 2009, 5:30 AM
Do not extend it. There's no point. There can be only one, so no need for a subclass.

Just create a Viewport with an items config.

7 Dec 2009, 5:30 AM
Dear isit.gd,

Animal has just replied to a thread you have subscribed to entitled - Ext.ViewPort - extend - in the Ext: Help forum of Ext JS Forums.

This thread is located at:

Here is the message that has just been posted:
What you posted has no basis in documentation. "regions.push()"? You just made that up.


yep - i invented the Array object!!




7 Dec 2009, 5:31 AM
that is actually what i'm doing but doing it in a more polymorphic way would have been better - architecturally speaking.

and saying 'there's no point' is a bit weird - of course there's a point.

7 Dec 2009, 5:33 AM
and it wasn't me who invented the array object - i didn't just make that up - tho it's nice of you to think i may have :)

7 Dec 2009, 5:46 AM
You can't polymorph a Viewport.

It is what it is, and can only be what it is. It encapsulated the document body. Do not attempt to subclass it!