0 Replies Latest reply on Apr 8, 2010 11:29 AM by BuebEspuenja

    Sort Data in AdvancedDataGrid (Fx 4)

    BuebEspuenja

      I'm having a problem sorting column data AdvancedDataGrid. I need to bring data AdvancedDataGridColumn ordered, but they are random, even ordering the array before populating the grid. I use an ArrayCollection to populate the dataProvider.
      ex:
      <mx:AdvancedDataGrid id="adg"
                               left="15"
                               right="15"
                               bottom="15"
                               top="158"
                               displayItemsExpanded="true"
                               draggableColumns="false"
                               themeColor="#A99B8E"
                               sortableColumns="true"
                               initialize="gc.refresh()"
                           >
              <mx:dataProvider>
                  <mx:GroupingCollection2 id="gc" source="{dpFlat}">
                      <mx:grouping>
                          <mx:Grouping>
                              <mx:GroupingField name="SEQGRP"/>
                              <mx:GroupingField name="SEQSUB"/>
                          </mx:Grouping>
                      </mx:grouping>
                  </mx:GroupingCollection2>
              </mx:dataProvider>
              <mx:columns>
                  <mx:AdvancedDataGridColumn dataField="DESCRICAO" />
              </mx:columns>
          </mx:AdvancedDataGrid>

       

      and array:
      [Bindable]
                  private var dpFlat:ArrayCollection = new ArrayCollection([
                      {SEQGRP:"Southwest", SEQSUB:"Arizona",
                          DESCRICAO:"Barbara Jennings", FONE:38865, Estimate:40000},
                      {SEQGRP:"Southwest", SEQSUB:"Arizona",
                          DESCRICAO:"Dana Binn", FONE:29885, Estimate:30000}, 
                      {SEQGRP:"Southwest", SEQSUB:"Arizona",
                          DESCRICAO:"Joe Smith", FONE:29134, Estimate:30000}, 
                      {SEQGRP:"Southwest", SEQSUB:"California",
                          DESCRICAO:"Bethany Pittman", FONE:52888, Estimate:45000}, 
                      {SEQGRP:"Southwest", SEQSUB:"Arizona",
                          DESCRICAO:"Lauren Ipsum", FONE:38805, Estimate:40000},
                      {SEQGRP:"Southwest", SEQSUB:"Arizona",
                          DESCRICAO:"T.R. Smith", FONE:55498, Estimate:40000}, 
                      {SEQGRP:"Southwest", SEQSUB:"California",
                          DESCRICAO:"Alice Treu", FONE:44985, Estimate:45000},
                      {SEQGRP:"Southwest", SEQSUB:"California",
                          DESCRICAO:"Jane Grove", FONE:44913, Estimate:45000}
                  ]);