views:

2546

answers:

3

I am using an advanced data grid that is using a custom item renderer for the column heading and now sorting doesn't work. If I take out the custom renderer it works fine but I need it to work with the renderer. Does anyone know how to do this? I am new to Flex and ActionScript.

A: 

Check the info on this page.

le dorfier
A: 

I am also facing the same problem. Have you got any solution for this ?

+1  A: 

You need to implement a sortCompareFunction for the DataGrid column:

For example:

<mx:DataGridColumn headerText="Foo" dataField="bar" sortCompareFunction="compareTypes">

Lets just pretend that this DataGridColumn as an inline item renderer...

And then the function is defined as follows:

public static function compareTypes(typeOne:Object, typeTwo:Object):int
{
    return ObjectUtil.stringCompare(String(typeOne.foo), String(typeTwo.foo));
}
clownbaby