You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flex.apache.org by "Justin Mclean (JIRA)" <ji...@apache.org> on 2013/09/13 02:08:53 UTC
[jira] [Updated] (FLEX-25369) Sorting DataGridColumn with complex
dataField throws Null Object Reference
[ https://issues.apache.org/jira/browse/FLEX-25369?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Justin Mclean updated FLEX-25369:
---------------------------------
Labels: easyfix easytest (was: )
> Sorting DataGridColumn with complex dataField throws Null Object Reference
> --------------------------------------------------------------------------
>
> Key: FLEX-25369
> URL: https://issues.apache.org/jira/browse/FLEX-25369
> Project: Apache Flex
> Issue Type: Bug
> Components: mx: DataGrid
> Affects Versions: Adobe Flex SDK 3.5 (Release)
> Environment: Affected OS(s): All OS Platforms
> Affected OS(s): All OS Platforms
> Browser: Firefox 3.x
> Language Found: English
> Reporter: Adobe JIRA
> Labels: easyfix, easytest
>
> Steps to reproduce:
> 1. Create a DataGrid with column with complex dataField (e.g. "company.address.street")
> 2. In the DataProvider place an object with one of the "middle" fields being null (e.g. company.address=null)
> 3. Try to sort DataGrid by the given column
>
> Actual Results:
> TypeError: Error #1009: Cannot access a property or method of a null object reference.
> at mx.controls.dataGridClasses::DataGridColumn/deriveComplexColumnData()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\dataGridClasses\DataGridColumn.as:1566]
> at mx.controls.dataGridClasses::DataGridColumn/complexColumnSortCompare()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\dataGridClasses\DataGridColumn.as:1584]
> at mx.collections::SortField/http://www.adobe.com/2006/flex/mx/internal::internalCompare()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\collections\SortField.as:234]
> at mx.collections::Sort/internalCompare()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\collections\Sort.as:831]
> at Array$/_sort()
> at Array/http://adobe.com/AS3/2006/builtin::sort()
> at mx.collections::Sort/sort()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\collections\Sort.as:749]
> at mx.collections::ListCollectionView/internalRefresh()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:1336]
> at mx.collections::ListCollectionView/refresh()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:402]
> at mx.controls::DataGrid/sortByColumn()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\DataGrid.as:3587]
> at mx.controls::DataGrid/headerReleaseHandler()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\DataGrid.as:4999]
> at flash.events::EventDispatcher/dispatchEventFunction()
> at flash.events::EventDispatcher/dispatchEvent()
> at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9440]
> at mx.controls.dataGridClasses::DataGridHeader/mouseUpHandler()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\dataGridClasses\DataGridHeader.as:1281]
>
> Expected Results:
>
> Sort working, with empty fields either in the beginning or in the end of the list.
>
> Workaround (if any):
>
> Create custom DataGridColumn and override deriveComplexColumnData function.
> Create custom sort function.
>
> Problem analysis and proposed patch:
> In the following code, if currentRef is null at any stage, the null object reference will be thrown.
> protected function deriveComplexColumnData( data:Object ):Object
> {
> var currentRef:Object = data;
> if ( complexFieldNameComponents )
> {
> for ( var i:int=0; i<complexFieldNameComponents.length; i++ )
> currentRef = currentRef[ complexFieldNameComponents[ i ] ];
> }
>
> return currentRef;
> }
> Proposed change would be (null cannot be returned due to later "toString" invocation on the resulting object) :
> protected function deriveComplexColumnData( data:Object ):Object
> {
> var currentRef:Object = data;
> if ( complexFieldNameComponents )
> {
> for ( var i:int=0; null!=currentRef && i<complexFieldNameComponents.length; i++ )
> currentRef = currentRef[ complexFieldNameComponents[ i ] ];
> }
>
> return (currentRef)?(currentRef):("");
> }
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira