OK I am sorting an XMLListCollection in alphabetical order. I have one issue tho, If the value is "ALL" I want it to be first in the list. Most cases this happens already but values that are numbers are being sorted before "ALL" ...I want "ALL" to always be the first selection in my dataProvider and then the rest alphabetical.
So I am tryint to write my own sort function, is there a way I can check if one of the values is all, and if not tell it to do the regular compare on the values?
here is what I have:
function myCompare(a:Object, b:Object, fields:Array = null):int
{
if(String(a).toLowerCase() == 'all')
{
return -1;
}
else if(String(b).toLowerCase() == 'all')
{
return 1;
}
// NEED to return default comparison results here?
}
//------------------------------
var sort:Sort = new Sort();
sort.compareFunction = myCompare;
Does anyone have a solution for what I am trying to do?
Thanks!!