You'll get errors if objects in the collection are missing properties mentioned in the sortFields, I think the first element is tested.
Your compare function will have to determine if the string is a number and if both are numbers, convert them to number and compare. For IP addresses you have to break them into their four parts convert to numbers and compare Alex Harui Flex SDK Developer Adobe Systems Inc.<http://www.adobe.com/> Blog: http://blogs.adobe.com/aharui From: [email protected] [mailto:[email protected]] On Behalf Of flexaustin Sent: Friday, June 12, 2009 9:06 AM To: [email protected] Subject: [flexcoders] Re: Sort: Datagrid sorting numbers and strings Ok, so I am closer. If I have this: 192.168.168.12 192.168.168.129 192.168.168.24 hellokitty bigsmelly When sorting I get this (with the normal flex sorting): 192.168.168.129 192.168.168.12 192.168.168.24 bigsmelly hellokitty And if I use my own sort function and perform several sorts quickly I get an Error: "Find criteria must contain at least one sort field value " My sort function: private function testCompareFunc(itemA:Object, itemB:Object):int { var valueA:String = itemA; var valueB:String = itemB; return ObjectUtil.stringCompare(valueA, valueB); } Any suggestions? Not sure how to do a string and number comparison. TIA --- In [email protected]<mailto:flexcoders%40yahoogroups.com>, "flexaustin" <flexaus...@...> wrote: > > Also the 192.12 are from xml so probably seen as Strings, not numbers. Would > that affect it? > > > > --- In [email protected]<mailto:flexcoders%40yahoogroups.com>, > "flexaustin" <flexaustin@> wrote: > > > > Using the built in sort I get > > > > angus > > 192.12 > > 187.34 > > hello > > range > > zoolu > > > > Wonder if their is a space or return before it in the data I am given? Not > > sure if that would affect it. > > > > > > > > > > --- In [email protected]<mailto:flexcoders%40yahoogroups.com>, > > Alex Harui <aharui@> wrote: > > > > > > The standard sort should sort those as: > > > > > > 192.12 > > > angus > > > hello > > > range 39.30 - 34.50 > > > zoolu 12 > > > > > > What did you want instead? It will probably require a custom sort function > > > > > > Alex Harui > > > Flex SDK Developer > > > Adobe Systems Inc.<http://www.adobe.com/> > > > Blog: http://blogs.adobe.com/aharui > > > > > > From: [email protected]<mailto:flexcoders%40yahoogroups.com> > > > [mailto:[email protected]<mailto:flexcoders%40yahoogroups.com>] > > > On Behalf Of flexaustin > > > Sent: Wednesday, June 10, 2009 8:43 AM > > > To: [email protected]<mailto:flexcoders%40yahoogroups.com> > > > Subject: [flexcoders] Sort: Datagrid sorting numbers and strings > > > > > > > > > > > > > > > > > > So I have a datagrid that has columns that can contain a number or string > > > or both. I was wondering if anyone has seen a sort function that can > > > handle this. Below is a sample of the types of data that can be in a > > > column. > > > > > > 192.12 > > > hello > > > angus > > > range 39.30 - 34.50 > > > zoolu 12 > > > > > > Anyway to sort these? > > > > > >

