Results 1 to 8 of 8

Thread: Ext.ViewPort - extend

  1. #1

    Default Ext.ViewPort - extend

    Hi

    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:

    Code:
     initComponent: function () {
            
            var regions = new Array();
    
            if (this.centerRegion) {
                regions.push(this.centerRegion);
            }
    
            if (this.northRegion) {
                regions.push(this.northRegion);
            }
    
            if (this.westRegion) {
                regions.push(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);
    
            this.doLayout();
        }
    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.

    w://

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    You can already add to it.

    It is a Container.

  3. #3

    Default

    well, what i posted doesn't seem to work. so...

  4. #4
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    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.

  5. #5

    Default

    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:
    http://www.extjs.com/forum/showthrea...5&goto=newpost

    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!!

    ?



    w://

  6. #6

    Default

    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. #7

    Default

    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

  8. #8
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •