[
https://issues.apache.org/jira/browse/FLEX-35237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15800792#comment-15800792
]
Pan Li commented on FLEX-35237:
-------------------------------
in DataGridLayout code
{code}
public function set strand(value:IStrand):void
{
_strand = value;
var host:UIBase = _strand as UIBase;
host.addEventListener("widthChanged",
handleSizeChanges);
host.addEventListener("heightChanged",
handleSizeChanges);
host.addEventListener("sizeChanged", handleSizeChanges);
host.addEventListener("layoutNeeded",
handleSizeChanges);
var view:DataGridView = host.view as DataGridView;
header = view.header;
listArea = view.listArea;
listArea.addBead(new BasicLayout());
}
{code}
in DataGridPercentageLayout, the even listeners are added after header is
assigned. In DataGridLayout code, the event listeners can trigger before the
header is set, thus result in runtime error. If I move them after header is
assigned, it works
I included my changes
> DataGridLayout is broken
> ------------------------
>
> Key: FLEX-35237
> URL: https://issues.apache.org/jira/browse/FLEX-35237
> Project: Apache Flex
> Issue Type: Bug
> Components: FlexJS
> Affects Versions: Apache FlexJS 0.7.0, Apache FlexJS 0.8.0
> Reporter: Pan Li
> Priority: Critical
> Attachments: ModifiedDataGridExampleForReproducingProblem.zip
>
>
> DataGridLayout doesn't work. To reproduce the problem:
> Take the SDK's datagrid sample, change
> DataGridPercentageLayout to
> <js:DataGridLayout />
> running the updated code in js mode, the application fails with javascript
> error:
> {code}
> TypeError: this._header is undefined[Learn More] DataGridLayout.js:81:5
> org.apache.flex.html.beads.layouts.DataGridLayout.prototype.layout
> file:///Users/lipan/Downloads/DataGridExampleTest/bin/js-debug/org/apache/flex/html/beads/layouts/DataGridLayout.js:81:5
>
> org.apache.flex.html.beads.layouts.DataGridLayout.prototype.handleSizeChanges
> file:///Users/lipan/Downloads/DataGridExampleTest/bin/js-debug/org/apache/flex/html/beads/layouts/DataGridLayout.js:130:3
> bound self-hosted
> goog.events.EventTarget.prototype.fireListeners
> file:///Users/lipan/Downloads/DataGridExampleTest/bin/js-debug/library/closure/goog/events/eventtarget.js:284:12
> goog.events.EventTarget.dispatchEventInternal_
> file:///Users/lipan/Downloads/DataGridExampleTest/bin/js-debug/library/closure/goog/events/eventtarget.js:381:12
> goog.events.EventTarget.prototype.dispatchEvent
> file:///Users/lipan/Downloads/DataGridExampleTest/bin/js-debug/library/closure/goog/events/eventtarget.js:196:10
> org.apache.flex.events.EventDispatcher.prototype.dispatchEvent
> file:///Users/lipan/Downloads/DataGridExampleTest/bin/js-debug/org/apache/flex/events/EventDispatcher.js:67:12
> org.apache.flex.core.ElementWrapper.prototype.dispatchEvent
> file:///Users/lipan/Downloads/DataGridExampleTest/bin/js-debug/org/apache/flex/core/ElementWrapper.js:211:12
> org.apache.flex.html.beads.DataGridView.prototype.createLists
> file:///Users/lipan/Downloads/DataGridExampleTest/bin/js-debug/org/apache/flex/html/beads/DataGridView.js:182:3
>
> org.apache.flex.html.beads.DataGridView.prototype.handleDataProviderChanged
> file:///Users/lipan/Downloads/DataGridExampleTest/bin/js-debug/org/apache/flex/html/beads/DataGridView.js:131:5
> bound self-hosted
> org.apache.f
> {code}
> check attachment for updated DataGridExample code.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)