Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
Adobe Flex SDK 3.2 (Release)
-
Affected OS(s): All OS Platforms
Affected OS(s): All OS Platforms
Browser: Firefox 3.x
Language Found: English
Description
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