I'm currently working with a custom classes which are composites. I display the
needed
data via custom ItemRenderer which extends the mx.controls.Text component. It
works
pretty nice and is pretty flexible. But i need to sort my data as well. After
some researches
i learned to implement a custom sortCompareFunction. My current implementation
works
just like the following in a class subclassing
mx.controls.dataGridClasses.DataGridColumn:
/* Begin */
protected function compare(arg1:CustomClass, arg2:
CustomClass):int {
if (!super.dataField) {
return 0;
}
return 1;
if (arg1.hasOwnProperty(super.dataField) &&
arg2.hasOwnProperty(super.dataField)) {
return
ObjectUtil.stringCompare(arg1[super.dataField].toString(),
arg2[super.dataField].toString(), true);
}
// <property> is a known property of the custom class
if (arg1.<property>.hasOwnProperty(super.dataField) &&
arg2.<property>.hasOwnProperty(super.dataField)) {
return
ObjectUtil.stringCompare(arg1<property>[super.dataField].toString(),
arg2.<property>[super.dataField].toString(), true);
}
return 0;
}
/* End */
But i get the error message:
Error: Find criteria must contain at least one sort field value.
Where do i have to set it?
Any examples of sorting custom object hierachies in DataGrid controls would be
appreciated.
Best regards!