2 Replies Latest reply on Aug 26, 2009 5:49 AM by Niranjan_swain

    Grouping issue on Advanced DataGrid

    nickmiddleweek Level 1

      Hello,

      I've got an advanced datagrid with 5 columns, The number_Group column has data like this...

      1-10
      1-10
      11-20
      11-20
      11-20
      21-30
      21-30
      21-30
      41-50
      101-110


      When I apply Grouping, it works as expected but the 101-110 group is displayed before the 11-20 group.

      I've tried to set groupingField.numeric = true but that screws it up even more... because 11-20 isn't a number I'm guessing.

      Does anyone know a way around this? I could change the number_Group column to this...

      1
      1
      11
      11
      21
      41
      101

      and groupingField.numeric = true should work but I need the Grouping display to show 1-10, 11-20. Perhaps I can intercept this and modify it?

       

      Anyone got any ideas?

       


      Thanks,
      Nick

        • 1. Re: Grouping issue on Advanced DataGrid
          nickmiddleweek Level 1

          Answer = use GroupingField.groupingFunction :-)

          Does anyone know what the groupingObjectFunction does? What is the returned Object for?


          Thanks,
          Nick

          • 2. Re: Grouping issue on Advanced DataGrid
            Niranjan_swain Level 1

            Hi, Nicky

             

            u can solve this problem by grouping function.

             

            u create ur dataprovider like

             

            private var myData:ArrayCollection = new  ArrayCollection([{data1:1, data2:10,......},

                                                                                                 {data1:1, data2:21, ....}]);

             

            u declare the grouping function in following manner

             

             

            private function myGroupLabelFunction(item:Object, column:AdvancedDataGridColumn):String

            {

            // here u write ur logice to formatting ur dispalying data in advance grid.

            //suppose ur labelfield of datagrid are data1,data2, data3 respectively.

             

            return item.data1+"-"+item.data2;

            }

             

            if u do in this way i think it will work.

            if u sucess then give me mark.

             

            Thanks

            Niranjan

            1 person found this helpful