Mihai Chira created FLEX-34065:
----------------------------------

             Summary: AdvancedDataGrid throws RTE #1009 when groupedColumns is 
set to null
                 Key: FLEX-34065
                 URL: https://issues.apache.org/jira/browse/FLEX-34065
             Project: Apache Flex
          Issue Type: Bug
          Components: Advanced Data Grid
    Affects Versions: Apache Flex 4.11.0
            Reporter: Mihai Chira
             Fix For: Apache Flex 4.12.0


Steps to reproduce: when run, the following application throws "Error #1009: 
Cannot access a property or method of a null object reference. at 
mx.controls::AdvancedDataGridBaseEx/commitProperties()..."

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:mx="library://ns.adobe.com/flex/mx"
                                        
xmlns:fx="http://ns.adobe.com/mxml/2009"; 
                                        
xmlns:s="library://ns.adobe.com/flex/spark">
        <mx:AdvancedDataGrid>
                <mx:groupedColumns/>
        </mx:AdvancedDataGrid>
</s:WindowedApplication>

Notes:
* in our application this is happening because OLAPDataGrid.commitProperties() 
sets "groupedColumns = []" when there are no column axes in the olap data.
* because AdvancedDataGrid relies on visibleHeaderInfos being null in some 
cases (see .drawHeaderHorizontalSeparators()), it seems that the assumption 
made by AdvancedDataGridBaseEx.commitProperties() - that visibleHeaderInfos 
cannot be null - is the one that needs to be changed. So the monkey patch we 
wrote until we have a fix in the framework replaces

if (horizontalScrollPosition > visibleHeaderInfos.length)
                horizontalScrollPosition = visibleHeaderInfos.length - 1;

...with

var noVisibleColumns:int = visibleHeaderInfos ? visibleHeaderInfos.length : 0;
            if (horizontalScrollPosition > noVisibleColumns)
                horizontalScrollPosition = noVisibleColumns == 0 ? 
noVisibleColumns : noVisibleColumns - 1;



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to