The data is fully populated at the time the column header is clicked. However some of the cells are null.
We certainly disagree on this:-) Since a null is a valid result for all data types, it seems to me that any sort algorithm should handle the universe of valid data elements for that type. Additionally there appears to be no way to write a generic sortCompareFunction handler that will handle any column from any datagrid. If this is true then the developer needs to decide what type of data is being stored in each column, can nulls ever exist in this column and then write a custom sort routine for that column. If in fact Flex cannot sort columns with nulls, and every column that could contain a null requires the developer to write a separate custom sort handler, I think that "serious shortcoming" is a polite way of stating the issue. Is there a way of working around this "feature?" Paul --- In flexcoders@yahoogroups.com, "Alex Harui" <[EMAIL PROTECTED]> wrote: > > Well, I don't see it as a shortcoming that we default to efficient sort > algorithms that assume that all values are of the same type. Seems like > all you need is a comparefunction for dates and one for numbers and > assign the correct function to the appropriate column. Also note that > if you sort with nulls for data that hasn't arrived yet, you'll probably > have to re-sort as the data arrives. The collections generally wait > until all data has arrived to do the sort so it doesn't have to keep > resorting as data has arrived. > > So, you could wait for all data to arrive as well, or maybe monkey- patch > the sort code to handle null. You can file an enhancement request, but > I don't see it getting done in 3.0 > > ________________________________ > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of aceoohay > Sent: Friday, November 30, 2007 9:13 AM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Re: Sorting problem on date and numbers with null > values, I think > > > > What is the workaround? > > The sortCompareFunction does not seem to be reasonable, since a > version needs to be written for each column in each grid. > > This seems like a serious shortcoming... > > Paul > > --- In flexcoders@yahoogroups.com <mailto:flexcoders% 40yahoogroups.com> > , "Alex Harui" <aharui@> wrote: > > > > THe default sort code can't handle null as it isn't a date or > number > > > > ________________________________ > > > > From: flexcoders@yahoogroups.com <mailto:flexcoders% 40yahoogroups.com> > > [mailto:flexcoders@yahoogroups.com <mailto:flexcoders% 40yahoogroups.com> > ] On > > Behalf Of aceoohay > > Sent: Thursday, November 29, 2007 8:49 PM > > To: flexcoders@yahoogroups.com <mailto:flexcoders% 40yahoogroups.com> > > Subject: [flexcoders] Re: Sorting problem on date and numbers with > null > > values, I think > > > > > > > > When I said no values returned from the DB, I meant that the grid > is > > populated with some records that have the values in the > number/date > > column, and others that don't. > > > > Paul > > --- In flexcoders@yahoogroups.com > <mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders% > 40yahoogroups.com> > > , "aceoohay" <pauls@> wrote: > > > > > > I running flexbuilder 2.0.1, AS 3. > > > > > > I have a number of datagrids. In two of my grids I have date and > > > number fields that sometimes have no values returned from the > DB. > > > When I click the heading on these columns to sort Ascending they > > work > > > fine. When I click a second time (descending) I get the > following > > > error; > > > > > > =============================================================== > > > Error: Cannot determine comparator for SortField with > > > name ''MyNumberDataField''. > > > at mx.collections::SortField/::nullCompare() > > > at > > > > > > mx.collections::SortField/http://www.adobe.com/2006/flex/mx/internal: > <http://www.adobe.com/2006/flex/mx/internal:> > : > > <http://www.adobe.com/2006/flex/mx/internal:: > <http://www.adobe.com/2006/flex/mx/internal::> > > > > internalCompare() > > > at mx.collections::Sort/::internalCompare() > > > at mx.collections::Sort/findItem() > > > at mx.collections::ListCollectionView/getItemIndex() > > > at ::ListCollectionViewCursor/::collectionEventHandler() > > > at > > > > > > flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchE > v > > > entFunction() > > > at flash.events::EventDispatcher/dispatchEvent() > > > at mx.collections::ListCollectionView/dispatchEvent() > > > at mx.collections::ListCollectionView/::internalRefresh() > > > at mx.collections::ListCollectionView/refresh() > > > at mx.controls::DataGrid/::sortByColumn() > > > at mx.controls::DataGrid/::headerReleaseHandler() > > > at > > > > > > flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchE > v > > > entFunction() > > > at flash.events::EventDispatcher/dispatchEvent() > > > at mx.core::UIComponent/dispatchEvent() > > > at mx.controls::DataGrid/mx.controls:DataGrid::mouseUpHandler > > > () > > > =============================================================== > > > > > > I am not using a sort compare function anywhere. I have other > text > > > type fields with nulls that seem to sort correctly. > > > > > > This seems like a bug. > > > > > > Any ideas? > > > > > > Paul > > > > > >