Hi,

I have a datagrid column that filled with Boolean value. Since the 
built-in sorting could not handle this type, I have to make my own 
sort function but I have failed so far :(

This is my compare function:
public function sortBoolean(pObj1:Object, pObj2:Object):int 
{               
        //isDefault is a Boolean value
        varvalue1:int = obj1.isDefault ? 1 : 0;
        var value2:int= obj2.isDefault ? 1 : 0;
                                
        if (value1 < value2) {
                return -1;
        } else if (value1 > value2) {
                return 1;
        } else {
                return 0;
        }
}

Whenever I use this sortBoolean, the rows that have isDefault 
to 'True' are being placed not accordingly.

I did try to use string value and use the built-in sorting function 
and it works perfect but unfortunately, I need to use boolean value 
for my project  :(

Please help.

Reply via email to