0

My AIR-Application is based on Mate. I receive Data from a SQLite and put the Date into a ArrayCollection.

In the class of my AdvancedDataGrid, i create a GroupingCollection via mxml. All works fine. I prefer to build the GroupingCollection in Actionscript. But i can't find anything, how to code this. In the adobe help itself, they create a GroupingCollection in mxml.

The goal is, to instanciate the gc in model of mate for another class. This will be a chart and the dataProvider must be the gc.

Another Idea is, to build the groupingCollection and put it into the model via two-way-bindung. But I'm not sure, if this will work.

Have you any hint for me?

Thank you Frank

Frank
  • 780
  • 1
  • 10
  • 22

1 Answers1

2

It works like this. What a fight.

        private function onCreationComplete () :void
        {
            adg.dataProvider = createDataProvider();
        }

        private function createDataProvider () :GroupingCollection2
        {
            var tmp:GroupingCollection2 = new GroupingCollection2();
            tmp.source = dpArrColl;
            tmp.grouping = adgGrouping();
            tmp.refresh(false);
            return tmp;
        }

        private function adgGrouping () : Grouping
        {
            var tmp:Grouping = new Grouping();
            tmp.fields = [groupingFieldArray()];
            return tmp;
        }

        private function groupingFieldArray () :GroupingField
        {
            var tmp:GroupingField = new GroupingField();
            tmp.name = "groupName1";
            tmp.summaries = [adgSummaries()];
            return tmp;
        }

        private function adgSummaries () : SummaryRow
        {
            var tmp:SummaryRow = new SummaryRow();
            tmp.summaryPlacement = "group";
            tmp.fields = [adgSummaryFiled1(), adgSummaryField2()];
            return tmp;
        }

        private function adgSummaryFiled1 () :SummaryField2
        {
            var tmp:SummaryField2 = new SummaryField2();
            tmp.dataField = "Sumfiel1";
            tmp.summaryOperation = "SUM";
            return tmp;
        }

        private function adgSummaryField2 () : SummaryField2
        {
            var tmp:SummaryField2 = new SummaryField2();
            tmp.dataField = "Sumfield2";
            tmp.summaryOperation = "COUNT";
            return tmp;
        }

I hope, someone will help this someday.

BR Frank

Frank
  • 780
  • 1
  • 10
  • 22