PDA

View Full Version : [FIXED] An error is thrown when the portal is put inside a form panel



oklymenko
16 Feb 2012, 8:50 AM
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:



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:



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 (http://www.sencha.com/forum/showthread.php?176387-Portal-example) 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):


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 [];
}
}
});

mitchellsimoens
16 Feb 2012, 12:28 PM
Thank you for the report.

cbaj26
20 Mar 2012, 5:50 AM
This issue still exists in 4.1 RC1.

mitchellsimoens
20 Mar 2012, 5:55 AM
This issue still exists in 4.1 RC1.

This thread is still marked as [OPEN]

nbourdeau
22 Mar 2012, 10:18 AM
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 :



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

unkn
16 Apr 2012, 4:29 AM
I have the same issue in Extjs 4 RC2, for same reasons

this.getComponentLayout().getDockedItems is not a function
var dockedItems = this.getComponentLayout().getDockedItems('render', beforeBody);
in ext-all-debug.js (ligne 46937)

ostghost
8 Jun 2012, 5:50 AM
I just upgraded from 4.0.7 to 4.1 and bug still occurs. Portal used.


this.getComponentLayout().getDockedItems is not a function
...var dockedItems = this.getComponentLayout().getDockedItems('render', beforeBody)

ext-all-debug-w-comments.js line 68468.

2dy4
31 Mar 2014, 12:05 AM
I got the error message from Ext.container.DockingContainer of ExtJS 4.1.1a and the error still is thrown after nbourdeau (http://www.sencha.com/forum/member.php?23954-nbourdeau) 's tweak. Here's my work-a-round:


Ext.override(Ext.container.DockingContainer, {
getDockedItems: function(selector, beforeBody) {
if (typeof(this.getComponentLayout().getDockedItems) === "function")
return this.callOverridden([selector, beforeBody]);
else
return [];
}
});

nbourdeau
11 May 2015, 2:52 PM
Is it possible to know in which release it has been fixed ?PS: why not make sencha.jira.com publicly accessible ?