Hi,
I've two grouping option, Category and Status. We have some unique number along with the categories like, "302 Explosives". Earlier after applying grouping on "category" field, column sorting was lost. To fix this I've applied "compareFunction". Now, Sorting is working fine when we use group by on "category" field ( image -1) but when try with "Status" , it's failing somewhere (image-2). Can anybody point my what's wrong ?
You can view the image here ,
Here is the code,
var mygroup:GroupingCollection=new GroupingCollection();
mygroup.source = dominoData;
var gf:GroupingField = new GroupingField(selItem);
gf.compareFunction = DoSortItems;
var group:Grouping = new Grouping();
group.fields = [gf];
mygroup.grouping = group;
mygroup.refresh();
dataGrid.dataProvider = mygroup;
and Comparefunction ,
private function DoSortItems(a:Object, b:Object,fields:Array=null):int { return ObjectUtil.stringCompare(a.hdnum.toString(),b.hdnum.toString()); }