You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by "Justin Mclean (JIRA)" <ji...@apache.org> on 2013/04/17 10:53:15 UTC

[jira] [Commented] (FLEX-22452) Error in SortField.nullCompare logic

    [ https://issues.apache.org/jira/browse/FLEX-22452?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13633908#comment-13633908 ] 

Justin Mclean commented on FLEX-22452:
--------------------------------------

Looking at nullCompare look like issue has been fixed.

Tested with this code:

<?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">
	
	<mx:AdvancedDataGrid sortableColumns="true" dataProvider="{[{num:23},{num:null},{num:34},{num:67},{num:1},{num:2},{num:3},{num:null},{num:9},{num:13}]}">
		<mx:columns>
			<mx:AdvancedDataGridColumn dataField="num" />
		</mx:columns>
	</mx:AdvancedDataGrid>
</s:Application>

                
> Error in SortField.nullCompare logic
> ------------------------------------
>
>                 Key: FLEX-22452
>                 URL: https://issues.apache.org/jira/browse/FLEX-22452
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: mx: General, Runtime Exceptions
>    Affects Versions: Adobe Flex SDK 3.2 (Release)
>         Environment: Affected OS(s): All OS Platforms
> Affected OS(s): All OS Platforms
> Browser: Firefox 3.x
> Language Found: English
>            Reporter: Adobe JIRA
>            Assignee: Justin Mclean
>              Labels: easyfix, easytest
>
> Steps to reproduce:
> 1. Populate an AdvancedDataGrid with multiple columns, one of which is a "Number" type
> 2. Have some of the Numbers be null and some be values
> 3. Sort on this column will crash with exception below
>  
>  Actual Results:
>  Error: Cannot determine comparator for SortField with name 'policy_score'.
> 	at mx.collections::SortField/nullCompare()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\collections\SortField.as:566]
> 	at mx.collections::SortField/http://www.adobe.com/2006/flex/mx/internal::internalCompare()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\collections\SortField.as:234]
> 	at mx.collections::Sort/internalCompare()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\collections\Sort.as:831]
> 	at mx.collections::Sort/findItem()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\collections\Sort.as:528]
> 	at mx.collections::ListCollectionView/getItemIndex()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:513]
> 	at ListCollectionViewCursor/collectionEventHandler()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:2154]
> 	at flash.events::EventDispatcher/dispatchEventFunction()
> 	at flash.events::EventDispatcher/dispatchEvent()
> 	at mx.collections::ListCollectionView/dispatchEvent()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:833]
> 	at mx.collections::ListCollectionView/internalRefresh()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:1275]
> 	at mx.collections::ListCollectionView/refresh()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:402]
> 	at mx.controls::AdvancedDataGridBaseEx/sortHandler()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\controls\AdvancedDataGridBaseEx.as:6864]
> 	at mx.controls::AdvancedDataGrid/sortHandler()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\controls\AdvancedDataGrid.as:6896]
> 	at flash.events::EventDispatcher/dispatchEventFunction()
> 	at flash.events::EventDispatcher/dispatchEvent()
> 	at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9298]
> 	at mx.controls::AdvancedDataGrid/headerReleaseHandler()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\controls\AdvancedDataGrid.as:7117]
> 	at flash.events::EventDispatcher/dispatchEventFunction()
> 	at flash.events::EventDispatcher/dispatchEvent()
> 	at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9298]
> 	at mx.controls::AdvancedDataGridBaseEx/mouseUpHandler()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\controls\AdvancedDataGridBaseEx.as:5733]
> 	at mx.controls::AdvancedDataGrid/mouseUpHandler()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\controls\AdvancedDataGrid.as:8454]
>  
>  Expected Results:
>  - Problem is that nullCompare checks attempts to get value for attribute for each row being compared.  If one of the rows returns a null value the the entire row is used as the value.  Rather, a null value should be treated either as the "lowest" value or the "highest" value for the purpose of numeric comparsions thereby pushing all nulls to the top or bottom of the list.  (I would suggest lowest)
>  
>  Workaround (if any):
> - write your own custom sort routine

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