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.
views:
2546answers:
3
+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
2009-12-02 19:58:02