tags:

views:

21

answers:

0

Here is my advance data grid without grouping , alt text

Once I apply grouping, sorting is getting lost, see below , alt text

Here is piece of code which is applied after grouping is done and the GroupingCollection is assigned 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); 
    }