3 Replies Latest reply on Aug 5, 2010 3:32 AM by rootsounds

    Sorting by month name in grouping collection (ADG)

    Sonunew2flex Level 1

      Dear friends,

       

      I am populating array collection dynamically.

       


      This is my ADG

       

                  <mx:AdvancedDataGrid right="0" left="0" top="28" bottom="0" id="adg_summary"  initialize="gc.refresh()"
                      change="gc.refresh()">
                      <mx:dataProvider>
                          <mx:GroupingCollection id="gc" source="{levhistory_DG}" >      
                              <mx:grouping>
                                  <mx:Grouping>
                                      <mx:GroupingField name="MONTH"/>
                                  </mx:Grouping>
                              </mx:grouping>
                          </mx:GroupingCollection>
                      </mx:dataProvider>           
                  <mx:columns>
                      <mx:AdvancedDataGridColumn dataField="VACATIONTYPE" headerText="Vacation Type"/>
                      <mx:AdvancedDataGridColumn dataField="DATE" headerText="Date"/>
                      <mx:AdvancedDataGridColumn dataField="DAYS" headerText="Days"/>
                      <mx:AdvancedDataGridColumn dataField="COMMENTS" headerText="Comments"/>
                  </mx:columns>
                  </mx:AdvancedDataGrid>

       

      Below Script i am taking the values in Array collection

              [Bindable]
              private var vachistory_DG:ArrayCollection = new ArrayCollection;

             private function result_history(event:ResultEvent):void
             {
                     vachistory_DG= new ArrayCollection;
                     vachistory_DG=srvsummaryADG.lastResult.LEAVELOAD.LEAVE;
                     vachistory_DG.removeItemAt(levhistory_DG.length-1);
                     vachistory_DG.removeItemAt(levhistory_DG.length-1);
                     sortByDate();
                
                  try
                  {
                      gc.refresh();
                  }
                  catch(e:Error)
                  {
                  }
             
             
             }

       

      now grouping happening is default as in ADG. In alphabetical order.

      like this

      August/2010
      January/2010
      July/2010
      June/2010
      May/2010

       

      But i want it like this

      January/2010
      May/2010
      June/2010
      July/2010
      August/2010

       

       

      How to do this i am new to flex.