You can use an ActionScript function to that see an example public function applyGrouping(field1:String,field2:String):void { mygroup = new GroupingCollection(); if (StringUtil.trim(field1).length >0){ mygroup.source = gridData; var group:Grouping = new Grouping(); var gf:GroupingField ; var sf:SummaryField; var sr:SummaryRow; var gf1:GroupingField; var sf1:SummaryField; var sr1:SummaryRow
if( StringUtil.trim(field1).length > 0 && StringUtil.trim (field2).length ==0) { gf =new GroupingField(field1); group.fields = new Array(); group.fields.push(gf); sr = new SummaryRow(); sr.summaryPlacement = "group"; sf = new SummaryField(field1); sf.operation="COUNT"; sf.label="summary"; sr.fields = new Array(); sr.fields.push(sf); gf.summaries = new Array(); gf.summaries.push(sr); } else if (StringUtil.trim(field1).length > 0 && StringUtil.trim(field2).length > 0) { gf = new GroupingField(field1); gf1 = new GroupingField(field2); group.fields = new Array(); group.fields.push(gf); group.fields.push(gf1); sr = new SummaryRow(); sr.summaryPlacement = "group"; sf = new SummaryField(field1); sf.operation="COUNT"; sf.label="summary"; sr.fields = new Array(); sr.fields.push(sf); gf.summaries = new Array(); gf.summaries.push(sr); sr1= new SummaryRow(); sr1.summaryPlacement = "group"; sf1= new SummaryField(field2); sf1.operation="COUNT"; //summaryFunction = func; sf1.label="summary"; sr1.fields = new Array(); sr1.fields.push(sf1); gf1.summaries = new Array(); gf1.summaries.push(sr1); } mygroup.grouping = group; mygroup.refresh(); dataGrid.dataProvider = mygroup; dataGrid.styleFunction = dataGrid_styleFunction; dataGrid.validateNow(); dataGrid.validateDisplayList(); dataGrid.expandAll(); } } call this on an appropriate change event. On Nov 10, 3:47 am, "Kameshwaran.Anandan" <kameshwaran.anan...@plateau.com> wrote: > Hi, > > I have a grouped collection which I show in an advanced datagrid,I have do > grouping based on the data that is coming in. > > For Example : > > In the below grouping collection I have added 3 grouping fields but I do not > want to apply all the 3 grouping for a subset of data or in other words for > only a subset of data which is given as source to the groupedCollection,I > want to apply all the 3 grouping which I have defined for the others I would > like to apply only 2 grouping, is it possible , if so please let me know > how? > > <mx:GroupingCollection id="gc" source="{ac}"> > <mx:Grouping> > <mx:GroupingField name="screeningGroupCategory"> > <mx:SummaryRow summaryPlacement="group"> > <mx:SummaryField summaryFunction="summFunc" > dataField="screeningGroupCategoryTotal" > label="Sub Total"/> > </mx:SummaryRow> > </mx:GroupingField> > <mx:GroupingField name="gtepSubScreeningGroup"> > <mx:SummaryRow summaryPlacement="group"> > <mx:SummaryField summaryFunction="summFunc" > dataField="gtepSubScreeningGroupTotal" > label="Sub Total"/> > </mx:SummaryRow> > </mx:GroupingField> > <mx:GroupingField name="accessionAFSC"> > <mx:SummaryRow summaryPlacement="group"> > <mx:SummaryField summaryFunction="summFunc" > dataField="accessionAFSCTotal" label="Sub > Total"/> > </mx:SummaryRow> > </mx:GroupingField> > </mx:Grouping> > </mx:GroupingCollection> > -- > View this message in > context:http://old.nabble.com/GroupedCollection--changing-the-grouping-field-... > Sent from the Flex India mailing list archive at Nabble.com. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_india@googlegroups.com To unsubscribe from this group, send email to flex_india+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~---