You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by "Alex Harui (JIRA)" <ji...@apache.org> on 2012/11/05 20:54:11 UTC

[jira] [Updated] (FLEX-28946) MX DataGrid default column sort breaks on NULL complex fields

     [ https://issues.apache.org/jira/browse/FLEX-28946?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alex Harui updated FLEX-28946:
------------------------------

    Labels: EasyFix  (was: )
    
> MX DataGrid default column sort breaks on NULL complex fields
> -------------------------------------------------------------
>
>                 Key: FLEX-28946
>                 URL: https://issues.apache.org/jira/browse/FLEX-28946
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: mx: DataGrid
>    Affects Versions: Adobe Flex SDK Previous
>         Environment: Affected OS(s): All OS Platforms
> Affected OS(s): All OS Platforms
> Language Found: English
>            Reporter: Adobe JIRA
>              Labels: EasyFix
>
>       Steps to reproduce:
> 1.Create an mx:DataGrid with an ArrayCollection dataProvider populated with Objects that have nested objects.
> 2.Set one of the properties of a nested object to null
> 3.Try sorting (by clicking on the header field) on a column that displays that property (eg. "address.city")
>  
>  Actual Results:
>  TypeError: Error #1009: Cannot access a property or method of a null object reference. 
>  thrown in DataGridColumn.complexColumnSortCompare
>  the code does not check if resulting value is null
>  Note: DataGridColumn.deriveComplexColumnData function also does not check if any component of complex property path is null
>  
>  Expected Results:
>  Grid sorted on that column, nulls handled corretly (first in ascending order)
>  
>  Workaround (if any):
>  Creating a custom compare function
> Example MXML:
> <?xml version="1.0" encoding="utf-8"?>
> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
> 			   xmlns:s="library://ns.adobe.com/flex/spark" 
> 			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
> 	<fx:Script>
> 		<![CDATA[
> 			[Bindable]
> 			public var data: Array = [
> 				{name: "Item1", address: {city: "City1"}},	
> 				{name: "Item2", address: {city: null}},	
> 			];
> 		]]
>       >
> 	</fx:Script>
> 	<fx:Declarations>
> 	</fx:Declarations>
> 	
> 	<mx:DataGrid dataProvider="{data}">
> 		<mx:columns>
> 			<mx:DataGridColumn headerText="Name" dataField="name" />
> 			<mx:DataGridColumn headerText="City" dataField="address.city" />
> 		</mx:columns>
> 	</mx:DataGrid>
> </s:Application>
>     

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