Hybrid View

  1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    25
    Answers
    6
    Vote Rating
    0
    Mteixeira is on a distinguished road

      0  

    Default Unanswered: new Ext.Window on ExtJS 4.0 vs ExtJS 4.1

    Unanswered: new Ext.Window on ExtJS 4.0 vs ExtJS 4.1


    I create a window like this

    Code:
    _target = new Ext.Window({                layer: 'top',
                    width: _width,
                    height: _height,
                    constrainTo: aBody,
                    constrain: true,
                    renderTo: aBody,
                    autoScroll: true,
                    flex: 1,
                    modal: (targetParams.Modal != undefined) ? targetParams.Modal : false,
                    resizable: (targetParams.Resizable != undefined) ? targetParams.Resizable : true,
                    minimizable: (targetParams.Minimizable != undefined) ? targetParams.Minimizable : true,
                    maximizable: (targetParams.Maximizable != undefined) ? targetParams.Maximizable : true,
                    closable: (targetParams.Closable != undefined) ? targetParams.Closable : true,
                    maximized: _maximized,
                    minimzed: _minimized,
                    isInFront: true
                });
    I noticed that the objects created in each version are quite different. I then do this:

    Code:
    _target.on("render", function (items) {                    if (items.length > 0) {
                            this.show();
                            this.add(items);
                            this.doLayout();
                            var buttonText = targetParams.ButtonText || this.title;
                            createToolbarButton(this.id, buttonText, targetParams.UIConfigurationId);
                        }
                        else {
                            _target.destroy();
                        }
                    });
    The problem is on the highlighted line. On 4.0 this line calls this function

    Code:
    show : function() {        this.callParent(arguments);
            this.performDeferredLayouts();
            return this;
        },
    But on the 4.1 the same line calls another function:

    Code:
    show: function(animateTarget, cb, scope) {        var me = this;
    
    
            if (me.rendered && me.isVisible()) {
                if (me.toFrontOnShow && me.floating) {
                    me.toFront();
                }
            } else if (me.fireEvent('beforeshow', me) !== false) {
                me.hidden = false;
    
    
                
                if (!me.rendered && (me.autoRender || me.floating)) {
                    me.doAutoRender();
                }
                if (me.rendered) {
                    me.beforeShow();
                    me.onShow.apply(me, arguments);
    
    
                    
                    
                    if (me.ownerCt && !me.floating && !(me.ownerCt.suspendLayout || me.ownerCt.layout.layoutBusy)) {
                        me.ownerCt.doLayout();
                    }
                    me.afterShow.apply(me, arguments);
                }
            }
            return me;
        },
    In which down the line tries to do
    Code:
    layout.renderChildren()
    and then it gives an error.

    I think it's obvious that the objects created are different, but i haven't seen this question addressed in the "Upgrade 4.0 to 4.1" document.

    So my question is what i have to do to make this work?

    Thanks in advance for the help.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,756
    Answers
    3462
    Vote Rating
    828
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Why do you have renderTo: aBody, ?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jul 2012
    Posts
    25
    Answers
    6
    Vote Rating
    0
    Mteixeira is on a distinguished road

      0  

    Default


    aBody it's the center region of a ViewPort.

    EDIT: I've looked a bit further and basically what we have is a main "screen" (the viewport) and we render all the other "screens" to the center region (aBody) of it. We choose window instead of panel, for example, to be able to have multiple "screens" opened at the same time, and give the ability to switch between them easily.

  4. #4
    Sencha User
    Join Date
    Jul 2012
    Posts
    25
    Answers
    6
    Vote Rating
    0
    Mteixeira is on a distinguished road

      0  

    Default


    UPDATE:


    The app structure after adding the window would look something like this:


    Code:
    ViewPort
        North
            ...
        West
            ...
        Center
            Window
                Panel
                    Panel
                        Label
                        ...
                    BorderSplitter
                    Panel
                        Label
                        ...
                Panel
                    List
        South
            ...
    I've made some changes to the code and it doesn't generated that error anymore.


    Code:
     _target.on("beforeRender", function (items) {
                        if (items.length > 0) {
                            _target.add(items);
                            _target.doLayout();
                            var buttonText = targetParams.ButtonText || _target.title;
                            createToolbarButton(_target.id, buttonText, targetParams.UIConfigurationId);
                        }
                        else {
                            _target.destroy();
                        }
                    });
                    _target.show();
                    _target.toFront();
    But now it generates another when i call
    Code:
    _target.add(items);
    .


    The error is "Unable to get the value of property 'dom'" on this line
    Code:
    me.container = container.dom ? container : Ext.get(container);
    .


    I've tried to analyze the call stack and found out why it give this error. When it calls this function:


    Code:
    renderChildren: function () {
            var me = this,
                items = me.getLayoutItems(),
                target = me.getRenderTarget();
    
    
            me.renderItems(items, target);
        },
    where "this" refers to the layout object of the window, to where i'm adding the items, the call "getRenderTarget()" returns undefined. Then tries to access the dom property of undefined, throwing the error i mentioned above.


    This is where i'm lost because, as you can see, when i'm creating the window i pass an object (aBody) to the renderTo property.


    Any ideas??

  5. #5
    Sencha User
    Join Date
    Jul 2012
    Posts
    25
    Answers
    6
    Vote Rating
    0
    Mteixeira is on a distinguished road

      0  

    Default


    It had to do with the layout. With layout 'fit' it seems to work.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi