Here is my advance data grid without grouping , alt text http://1.bp.blogspot.com/_T_-j3ZLqfNQ/TE-bkKh76uI/AAAAAAAABqg/65dHe-tzj1A/s1600/4.PNG
Once I apply grouping, sorting is getting lost, see below , alt text http://3.bp.blogspot.com/_T_-j3ZLqfNQ/TE-bqbDQr4I/AAAAAAAABqo/InBWCerJ3H4/s1600/5.PNG
Here is piece of code which is applied after grouping is done and the GroupingCollection is as开发者_如何转开发signed to the grid.
//Sorting grid once grouping done
dataGrid.validateNow();
var s:Sort = new Sort();
s.fields = [new SortField("hazardnum")];
s.compareFunction = hazardSortItems;
dataGrid.dataProvider.sort=s;
dataGrid.dataProvider.refresh();
Here is my compare function,
private function hazardSortItems(a:Object, b:Object,fields:Array=null):int {
return ObjectUtil.stringCompare(a.hazardnum.toString(),b.hazardnum.toString(),false);
}
精彩评论