correct: 1,2,3,4,11,12,21
incorrect: 1,11,12,2,21,3,4
private function sortCompareFunction(obj1:Object, obj2:Object, column:GridColumn): int { var p1:Number = obj1[column.dataField]; var p2:Number = obj2[column.dataField]; if (p1 < p2){ return -1; } else if (p1 > p2){ return 1; } else { return 0; } }
<s:DataGrid> <s:columns> <s:ArrayList> <s:GridColumn dataField="d1" headerText="h1" sortCompareFunction="sortCompareFunction"/> <s:GridColumn dataField="d2" headerText="h2" sortCompareFunction="sortCompareFunction"/> <s:GridColumn dataField="d3" headerText="h3" sortCompareFunction="sortCompareFunction"/> </s:ArrayList> </s:columns> </s:DataGrid>