4 Replies Latest reply on Jun 13, 2008 6:00 AM by Schwier

    Advanced Datagrid

    core009 Level 1
      How can I use data returned from a HTTPService call to used for the Advanced Datagrid control?

      Once the HTTP Service result is returned, I laod it into a arrayCollection. But I can't get the grouping function to work.

      ------------------------------

      <mx:HTTPService url=http://servieURL id='planets' resultFormat=Array/>

      <mx:AdvancedDataGrid
      id="adg"
      width="450"
      variableRowHeight="true"
      wordWrap="true"
      initialize="gc.refresh();">

      <mx:dataProvider>
      <mx:GroupingCollection id="gc" source="{new mx.collections.ArrayCollection(planets)}">
      <mx:Grouping>
      <mx:GroupingField name="kind">
      </mx:GroupingField>
      </mx:Grouping>
      </mx:GroupingCollection>
      </mx:dataProvider>

      <mx:columns>
      <mx:AdvancedDataGridColumn dataField="planet"
      headerText="Planet" />
      <mx:AdvancedDataGridColumn dataField="year_duration"
      headerText="Year duration" />
      <mx:AdvancedDataGridColumn dataField="moons"
      headerText="Moons" />
      <mx:AdvancedDataGridColumn dataField="cost"
      headerText="Cost" />
      </mx:columns>



      </mx:AdvancedDataGrid>
        • 1. Advanced Datagrid
          Hickeroar
          Upon receiving the results of the request and putting them into your "planets" ArrayCollection, try one of these this in actionscript:

          adg.executeBindings();
          - and/or -
          gc.source = new mx.collections.ArrayCollection(planets);

          My example isn't just like yours, but when using a Hierarchical dataProvider for my ADG, I had to "reset" the grid every time using the "executeBindings()" method after I got/set-up my data from the server.

          • 2. Re: Advanced Datagrid
            SrinivasAnnam Adobe Employee
            Did your issue solved with the above solution ?

            If not, please reply back with the exact peice of code so that we can help you further.
            • 3. Re: Advanced Datagrid
              core009 Level 1
              I figured it out. The issue was that my HTTPService call was being loaded into the ArrayCollection before I executed the Grouping function, therefore I was getting an error. I now load the Grouping function in the result event of the HTTPService and it works.

              Thanks!
              • 4. Re: Advanced Datagrid
                Schwier
                Hi, almost same problem here.

                I am using a HTTP service for the advanced datagrid. If I don't using grouping the grid works fine. But if I use grouping: the grid remains empty. Can anybody tell me why?

                Thnx!

                a sample of the xml:

                <Data>
                - <Item>
                <DBCCode>05-11-XX-1701-223</DBCCode>
                <DBCNaam>Arthrosis: Bekken/heup/b.been-Oper klin gewrichtsp</DBCNaam>
                <Benchmark>Algemeen</Benchmark>
                <Afdeling>Laboratorium</Afdeling>
                <TVG>(Micro-)Biologie</TVG>
                <Profiel>0.637368528732515</Profiel>
                <Kosten>4</Kosten>
                <DBCAantal>4887</DBCAantal>
                <Segment>B-segment</Segment>
                </Item>


                The advanced grid that fills with data:

                <mx:AdvancedDataGrid id="adg1" designViewDataType="tree" dataProvider="{dsOLAPperDBC}">
                <mx:groupedColumns>
                <mx:AdvancedDataGridColumn headerText="Benchmark" dataField="Benchmark"/>
                <mx:AdvancedDataGridColumn headerText="Afdeling" dataField="Afdeling"/>
                <mx:AdvancedDataGridColumn headerText="TVG" dataField="TVG"/>

                <mx:AdvancedDataGridColumnGroup headerText="Profiel">
                <mx:AdvancedDataGridColumn headerText="Profiel" dataField="Profiel"/>
                </mx:AdvancedDataGridColumnGroup>
                <mx:AdvancedDataGridColumnGroup headerText="Kosten">
                <mx:AdvancedDataGridColumn headerText="Kosten" dataField="Kosten"/>
                </mx:AdvancedDataGridColumnGroup>
                </mx:groupedColumns>
                </mx:AdvancedDataGrid>



                The advanced grid that does NOT fill with data:

                <mx:AdvancedDataGrid id="adg2" initialize="gc.refresh();">
                <mx:dataProvider>
                <mx:GroupingCollection id="gc" source="{dsOLAPperDBC}">
                <mx:Grouping>
                <mx:GroupingField name="Benchmark"/>

                </mx:Grouping>
                </mx:GroupingCollection>
                </mx:dataProvider>

                <mx:columns>
                <mx:AdvancedDataGridColumn headerText="Benchmark" dataField="Benchmark"/>
                <mx:AdvancedDataGridColumn headerText="Afdeling" dataField="Afdeling"/>
                <mx:AdvancedDataGridColumn headerText="TVG" dataField="TVG"/>
                <mx:AdvancedDataGridColumn headerText="Profiel" dataField="Profiel"/>
                <mx:AdvancedDataGridColumn headerText="Kosten" dataField="Kosten"/>
                </mx:columns>
                </mx:AdvancedDataGrid>

                The HTTP service:

                <mx:HTTPService
                id="OLAPperDBC"
                useProxy="false" showBusyCursor="true" result="ProcessOLAPperDBC(event.result);">
                <mx:request>
                <specialisme>orthopedie</specialisme>
                <DBC>05-11-xx-1701-223</DBC>
                </mx:request>
                </mx:HTTPService>