Not entirely sure about why it in the middle of your order. But I've
handled this in Flash by doing the following:

For display, set up a custom cellRenderer (listItemRenderer) that
checks for undefined values and gives them a default display value:
e.g. NA (Not Available) etc.

For sort, provide a custom sort function (this is where you can do a
toUpper or toLower conversion for case insensitive sorting).  When you
encounter a null value (blank) assign a value in the sort function
that is higher/lower to put it where you want it. An example is:

function dateSort1(a:Object, b:Object, index:Number){
        a=a.datemodified.getTime();
        b=b.datemodified.getTime();
        if(a == null) a=0;
        if(b == null) b=0;
        if(asc1){
                trace("ascend");
                if(a > b){
                return 1;
                }else if (a < b){
                        return -1;
                }else{
                        return 0;
                }
        }else{
                trace("descend");
                if(a > b){
                        return -1;
                }else if (a < b){
                        return 1;
                }else{
                        return 0;
                }
        }
}

This was for date object in Flash (asc1 is boolean that keeps track of
which direction your sort was last time), but I think it will apply
with editing. You also then need to point to this function by setting your

  myGrid.dataGridColumns sortOnHeaderRelease=false;
  myGrid.sortCompareFunction=dateSort1();

Then make a listener: 

  myGrid.addEventListener("headerRelease", headerListener);

and supply the function that distinguishes the selectedIndex of the
column of interest:

var headerListener = new Object();
        headerListener.headerRelease = function(eventObj){
                if(eventObj.columnIndex==4){
                        Grid.dataProvider.sortItems(dateSort1);

The last two steps can be combined, and you'll have to alter the event
types as necessary to comply with Flex data types (look at the
addEventListener docs), but this should give you a leg up. I know it's
a pain, but then what isn't? (someone probaly can do this in 5 lines).

Good Luck - hope this helps.

--- In [email protected], "george_lui" <[EMAIL PROTECTED]> wrote:
>
> Hi,
> 
> When you sort columns in a datagrid, I assume that data in a column is
> sorted according to its natural sorting order (whatever that may be).
>  In my case it's a string.
> 
> For some reason, the sorting on this column behaves differently.  I
> have data that begins with uppercase and lowercase letters, and
> columns that are just blank.  When I sort on this column I get
> uppercase, blank, and lowercase (and vice versa when sorting in the
> reverse order).  I'm expecting the sort to be uppercase, lowercase,
> and blank (and vice versa).
> 
> Is anyone aware of such a behavior?  It's hard for me to pinpoint
> because I don't have this behavior on my local build, but it's there
> in a staging build.
> 
> 
> Thanks,
> George
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
1.2 million kids a year are victims of human trafficking. Stop slavery.
http://us.click.yahoo.com/WpTY2A/izNLAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to