Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-5390 in a recent build.
  1. #1
    Ext JS Premium Member
    Join Date
    Dec 2009
    Posts
    65
    Vote Rating
    3
    oklymenko is on a distinguished road

      0  

    Default An error is thrown when the portal is put inside a form panel

    An error is thrown when the portal is put inside a form panel


    Ext version tested:
    • 4.0.7
    • 4.1.0-beta-2
    Browser versions tested against:
    • IE9
    • Chrome
    • FF
    Description:
    • If a portal is placed inside a FormPanel, a JS error is thrown when the form is rendered. If the portal is in a regular Panel, no error occurs.
    Steps to reproduce the problem:
    • Create a FormPanel that contains a Ext.app.PortalPanel
    • Render the FormPanel.
    The result that was expected:
    • The FormPanel is rendered with the portal
    The result that occurs instead:
    • A JavaScript error is thrown from the getDockedItems method:
    Code:
    getDockedItems : function(selector, beforeBody) {
            var dockedItems = this.getComponentLayout().getDockedItems('render', beforeBody);
            ...
    }
    this.getComponentLayout returns the 'body' layout which does not have the getDockedItems method.

    Test Case:


    Code:
    Ext.onReady(function () {
        Ext.create('Ext.FormPanel', {
            renderTo: 'portal-test',
            title: 'Portal Test',
            margin: 20,
            width: 600,
            height: 400,
            layout: 'fit',
    
            items:
            [
                {
                    xtype: 'portalpanel',
                    region: 'center',
                    items:
                    [
                        {
                            items:
                            [
                                {
                                    title: 'Portlet 1',
                                    height: 100
                                },
                                {
                                    title: 'Portlet 2',
                                    height: 100
                                }
                            ]
                        }
                    ]
                }
            ]
        });
    });
    HELPFUL INFORMATION
    I created this report off of another post to make sure it gets processed as a bug.

    I was able to mitigate it by using the following override (not sure if it's correct, but it worked for me):
    Code:
    Ext.override(Ext.app.PortalPanel, {
        getDockedItems: function (selector, beforeBody) {
            var layout = this.getComponentLayout();
            if (layout.getDockedItems) {
                var dockedItems = layout.getDockedItems('render', beforeBody);
                if (selector && dockedItems.length) {
                    dockedItems = Ext.ComponentQuery.query(selector, dockedItems);
                }
                return dockedItems;
            }
            else {
                return [];
            }
        } 
    });

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,347
    Vote Rating
    846
    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


    Thank you for the report.
    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
    Ext JS Premium Member
    Join Date
    Jun 2007
    Posts
    21
    Vote Rating
    0
    cbaj26 is on a distinguished road

      0  

    Default


    This issue still exists in 4.1 RC1.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,347
    Vote Rating
    846
    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


    Quote Originally Posted by cbaj26 View Post
    This issue still exists in 4.1 RC1.
    This thread is still marked as [OPEN]
    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.

  5. #5
    Touch Premium Member
    Join Date
    Jan 2008
    Location
    Quebec, Canada
    Posts
    122
    Vote Rating
    1
    nbourdeau is on a distinguished road

      0  

    Lightbulb Possible fix

    Possible fix


    I have the same error in other circumstances ... I think that the problem arrise when using a component which overrides Panel in the hierarchy but do not use the componentLayout of DockingContainer ...

    To prevent this problem, i've done this :

    Code:
    Ext.override(Ext.panel.Panel, {
        getDockedItems:function (selector, beforeBody) {
            if (this.getComponentLayout().getDockedItems)
                return this.callOverridden([selector, beforeBody]);
            else
                return [];
        }
    });
    Maybe not elegant but functionnal ...

  6. #6
    Sencha User unkn's Avatar
    Join Date
    Mar 2011
    Posts
    5
    Vote Rating
    2
    unkn is on a distinguished road

      0  

    Default


    I have the same issue in Extjs 4 RC2, for same reasons
    Code:
    this.getComponentLayout().getDockedItems is not a function
    var dockedItems = this.getComponentLayout().getDockedItems('render', beforeBody);
    in ext-all-debug.js (ligne 46937)

  7. #7
    Sencha Premium Member
    Join Date
    Jun 2007
    Location
    Ostrava, Czech Republic
    Posts
    43
    Vote Rating
    2
    ostghost is on a distinguished road

      0  

    Default Bug persist

    Bug persist


    I just upgraded from 4.0.7 to 4.1 and bug still occurs. Portal used.

    Code:
    this.getComponentLayout().getDockedItems is not a function
    ...var dockedItems = this.getComponentLayout().getDockedItems('render', beforeBody)
    ext-all-debug-w-comments.js line 68468.

  8. #8
    Sencha User
    Join Date
    Mar 2014
    Posts
    3
    Vote Rating
    0
    2dy4 is on a distinguished road

      0  

    Default


    I got the error message from Ext.container.DockingContainer of ExtJS 4.1.1a and the error still is thrown after nbourdeau 's tweak. Here's my work-a-round:
    Code:
    Ext.override(Ext.container.DockingContainer, {
        getDockedItems: function(selector, beforeBody) {
            if (typeof(this.getComponentLayout().getDockedItems) === "function")
                return this.callOverridden([selector, beforeBody]);
            else
                return [];
        }
    });