2 Replies Latest reply on Feb 10, 2010 9:32 AM by bitwyse

    Advanced Datagrid Grouping

    bitwyse Level 1

      Hi All,

       

      I am trying to create an advanced data grid that groups by the first column of data.  I am using xml as my source data and can not for the life of me figure out how to do this.

       

      I have read many samples on-line but they all deal with Value Objects in ArrayCollections.  Not XML in an XMLListCollection.  I am uploading a sample off the XML to see if anyone can help.

       

      I have a basic application that works just fine showing the data in the datagrid without grouping.  I just can't figure out how to group it.  Any help would be greatly appreciated. . .

       

      Here is the data grid code and the two label functions

       

      private function getLabelDocumentCategory( row : Object, column : Object ) : String
      {
          if( row.entrydata.( @columnnumber == '0' ) )
              return row.entrydata.( @columnnumber == '0' ).text;
          return "";
      }

       

      private function getLabelDocumentFileName( row : Object, column : Object ) : String
      {
          if( row.entrydata.( @columnnumber == '1' ) )
              return row.entrydata.( @columnnumber == '1' ).text;
          return "";
      }

       

       

      <mx:AdvancedDataGrid id="advDataGridFiles" dataProvider="{gAuditFilesXMLCollection}"
                      toolTip="Double Click to View Details"
                      doubleClickEnabled="true" doubleClick="viewDetails( event )"
                      width="100%" height="100%" variableRowHeight="true">
                          <mx:columns>
                              <mx:AdvancedDataGridColumn headerText="Category" dataField="text" labelFunction="getLabelDocumentCategory" sortCompareFunction="compareNonDateValues" width="450"/>                           
                              <mx:AdvancedDataGridColumn headerText="Title" dataField="text" labelFunction="getLabelDocumentFileName" sortCompareFunction="compareNonDateValues" width="450"/>                           
                          </mx:columns>
      </mx:AdvancedDataGrid>