1 Reply Latest reply on Oct 25, 2010 4:53 AM by jfb00

    XML for Advanced Data Grid

    leonapster

      I have to grouping by id and then (on click on id row) show "text" field

       

       

       

      My code

       

      <mx:AdvancedDataGrid x="10" y="10" id="adg1" designViewDataType="tree" width="100%" height="100%" creationComplete="myGroup.refresh();">
              <mx:dataProvider>
                  <mx:GroupingCollection2 id="myGroup" source="{logCollection}">
                          <mx:Grouping>
                              <mx:GroupingField name="text"/>
                          </mx:Grouping>
                  </mx:GroupingCollection2>
              </mx:dataProvider>
              <mx:columns>
                  <mx:AdvancedDataGridColumn headerText="ID" dataField="id"/>
                 
                 
              </mx:columns>
          </mx:AdvancedDataGrid>

       

       

      XML

       

      <logs>

           <log>

                <id>1</id>

                <text>some text...</text>

           </log>

           <log>

                <id>2</id>

                <text>some text...</text>

           </log>

          <log>

                <id>3</id>

                <text>some text...</text>

           </log>

      </logs>

        • 1. Re: XML for Advanced Data Grid
          jfb00 Level 3

          Hi,

          Is this what you need?

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600" creationComplete="init()">
              <mx:Script>
                  <![CDATA[
                      public function init():void{
                         
                      }
                     
                      private var companyData:XML = <data>
                          <logs>
                              <log>
                                   <id>1</id>
                                   <text>some text 1...</text>
                              </log>
                              <log>
                                   <id>2</id>
                                   <text>some text 2...</text>
                              </log>
                             <log>
                                   <id>3</id>
                                   <text>some text 3...</text>
                              </log>
                         </logs>
                      </data>;
                     
                  ]]>
              </mx:Script>
              <mx:AdvancedDataGrid id="companyADG"
                                   dataProvider="{companyData..log}"
                                   width="500"
                                   height="281"
                                   displayItemsExpanded="true">
                  <mx:columns>
                      <mx:AdvancedDataGridColumn dataField="id"
                                                 headerText="LOG"/>
                      <mx:AdvancedDataGridColumn dataField="text"
                                                 headerText="Text"/>
                  </mx:columns>
              </mx:AdvancedDataGrid>
             
              <mx:AdvancedDataGrid x="10" y="289" id="adg1" designViewDataType="tree" width="660" height="383" creationComplete="myGroup.refresh();">
                  <mx:dataProvider>
                      <mx:GroupingCollection id="myGroup" source="{companyData..log}">
                          <mx:Grouping>
                              <mx:GroupingField name="id"/>
                          </mx:Grouping>
                      </mx:GroupingCollection>
                  </mx:dataProvider>
                  <mx:columns>
                      <mx:AdvancedDataGridColumn headerText="TEXT" dataField="text"/>
                  </mx:columns>
              </mx:AdvancedDataGrid>
             
          </mx:Application>

           

          Johnny

          Please rate answers