1 Reply Latest reply on May 8, 2009 6:06 AM by Gregory Lafrance

    Advanceddatagrid with grouping - how to sort?

    shaunperry Level 1



      I have an advanced datagrid with a groupingfield. The data is passed from Coldfusion into the dataprovider in the correct order. For some reason the grid seems to change the row ordering. On googling this issue I found various notes that I need to resort the data once its in, but I m struggling to get it to work, can anyone help?



      private function initDG():void {
                          var group:Grouping=new Grouping();
                          var gf:GroupingField=new GroupingField("groupName");
                          testgrid.dataProvider.sort = new Sort();
                          testgrid.dataProvider.sort.fields = [new SortField("groupName", true, false), new SortField("articleNumber", true, false)];                              
      <mx:AdvancedDataGrid width="878" height="100%" id="testgrid" editable="false" dataProvider="{dgData}" creationComplete="initDG();">
                                     <mx:AdvancedDataGridColumn headerText="Article Number" dataField="articleNumber" width="188" editable="false" sortable="false" />
                                     <mx:AdvancedDataGridColumn headerText="Article Name" dataField="itemName" width="305" editable="false" sortable="false" />
                                     <mx:AdvancedDataGridColumn headerText="Colourway" dataField="colourway" width="275" editable="false" sortable="false" />
                                       <mx:AdvancedDataGridColumn editable="false" sortable="false" paddingLeft="1">