You have to do a sortCompareFunction, ala

<mx:DataGridColumn dataField="number"
sortCompareFunction="{sortOnNumber}" />

and then create something like:

private function sortOnNumber( obj1:Object, obj2:Object ):int
                        {
                                if( obj1["number"] < obj2["number"] ) {
                                        return -1;
                                }
                                else if( obj1["number"] >
obj2["number"] ) {
                                        return 1;
                                }
                                else {
                                        // They are equal so do
another col sort if you want
                                        if( obj1["ID"] < obj2["ID"] ) {
                                                return -1;
                                        }
                                        else if( obj1["ID"] >
obj2["ID"] ) {
                                                return 1;
                                        }
                                        else {
                                                return 0;
                                        }
                                }
                        }


--- In flexcoders@yahoogroups.com, "mr_j_harris" <[EMAIL PROTECTED]> wrote:
>
> 
> 
> Datagrid sort order: is there a natsort() such as in PHP?
> 
> 
> This is sort order on some strings:
> 
> 1
> 10
> 11
> 2
> 21
> 23
> 
> This natsort order on the same strings:
> 1
> 2
> 10
> 11
> 21
> 23
> 
> In short, it deals sanely with a numeric string suffix.  Anything like
> that in Flash/Flex out-of-the-box?
> 
> -- John
>


Reply via email to