You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by jfb <j....@verizon.net> on 2014/03/28 14:49:01 UTC
ADG sort with grouping collection
Hi All,
I lost my DB sort in advanced datagrid after apply the grouping collection.
<grids:dataProvider>
<mx:GroupingCollection2 id="gc">
<mx:grouping>
<mx:Grouping label="YEAR">
<mx:GroupingField name="FY"
groupingFunction="formFieldGroup" compareFunction="stringCompareFunction"/>
</mx:Grouping>
</mx:grouping>
</mx:GroupingCollection2>
</grids:dataProvider>
<grids:columns>
<columns:ExtendedAdvancedDataGridColumn
headerText="DESCRIPTION" dataField="KEY" width="200" />
My DB grouping Field is FY but I want to sort the field KEY(string).
I try this in my script code:
//Get data
gc.source = acData;
gc.refresh();
private function stringCompareFunction(a:Object, b:Object):int{
return ObjectUtil.stringCompare(a.KEY, b.KEY);
}
private function formFieldGroup(data:Object, field:GroupingField):String{
return data[field.name];
}
But it is displaying the FY(year) multiple times with each KEY (String).
Any ideas?
Thanks
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/ADG-sort-with-grouping-collection-tp5828.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.
Re: ADG sort with grouping collection
Posted by jfb <j....@verizon.net>.
I fixed my issue:
private function stringCompareFunction(a:Object, b:Object):int{
var s1:String = a.FY + a.KEY;
var s2:String = b.FY + b.KEY;
return ObjectUtil.stringCompare(s1, s2);
}
Thanks!
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/ADG-sort-with-grouping-collection-tp5828p5829.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.