Flex - how do I sort the datagrid column that uses the item renderer in the header?
I am using an advanced data grid that uses specialized item rendering for the column header and now sorting is not working. If I output a 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.
+1
arlull
source
to share
1 answer
You need to implement sortCompareFunction for the DataGrid column:
For example:
<mx:DataGridColumn headerText="Foo" dataField="bar" sortCompareFunction="compareTypes">
Lets just pretend this DataGridColumn is an inline item renderer ...
And then the function is defined like this:
public static function compareTypes(typeOne:Object, typeTwo:Object):int
{
return ObjectUtil.stringCompare(String(typeOne.foo), String(typeTwo.foo));
}
+1
source to share