1 Reply Latest reply on Jul 20, 2011 6:02 AM by jfb00

    Default sort AdvancedDataGrid

    GabrielGPP

      You can sort a column in an AdvancedDataGrid Flex 4 from a button instead of clicking on the header?

        • 1. Re: Default sort AdvancedDataGrid
          jfb00 Level 3

          Hi,

          Yes you can do that. Just turn off the sort in the datagrid with sortableColumns="false"

          From you click button method call a function that will do the sort you array collection for you like:

           

          private function mySort():void{
                          //New Sort
                          var sort:Sort = new Sort();
                          sort.fields = [new SortField("Field01",true),
                              new SortField("Field02",true),
                              new SortField("Field03",true)];
                          sort.fields[2].numeric = true; //where Field03 is date
                          acOfADG.sort = sort; //where acOfADG is the array collection of the advance datagrid
                          acOfADG.refresh();
                      }
          

           

          I hope this help.

          Best

           

          JFB