2 Replies Latest reply on Mar 2, 2009 12:39 PM by Newsgroup_User

    ADG First Non Grouped Column order not preserved

    oplin
      Think this might be a bug but wanted to post on here before putting it as a bug, figured there's probably something i'm just missing. Anyway I have an AdvancedDataGrid, with a GroupingCollection dataprovider, the source is in order the way it should be, and when refresh is don on the gc it uses the fields that are grouped to sort the list (this is fine), but on the first item that isn't grouped the order is not guaranteed to be preserved, so when the refresh is being done the groupedcolumns are in asc order but the first non grouped level is usually in order but on some reports we have this is out of order, i traced the code to the groupingcollection makeGroupedCollection, which uses the groupingfields to build the sort, then ListCollectionView's internalRefresh does basically calls a source.sortOn(fieldsList, options); source is an Array, and the documentation states that the fields will be in asc order Array.sortOn
      If you pass multiple fieldName parameters, the first field represents the primary sort field, the second represents the next sort field, and so on. Flash sorts according to Unicode values. (ASCII is a subset of Unicode.) If either of the elements being compared does not contain the field that is specified in the fieldName parameter, the field is assumed to be set to undefined, and the elements are placed consecutively in the sorted array in no particular order.

      But i need these items to be in order so is there a property or sort i can set so this happens, didn't see anyway to add it in the groupingcollection, and sorting on a column in the adg gets rid of the sorts on the columns in asc order which is no good. 99% of the time that sortOn leaves the items in order and there is just one issue that has popped up, here is some code to reproduce it, if anyone has any ideas that would be great. Need the last non grouped column to remain in order.

        • 1. Re: ADG First Non Grouped Column order not preserved
          oplin Level 1
          If the GroupingCollection allowed you to take the first non-grouped colum and use it as a sort this would work, in the method makeGroupedCollection, and then the fieldList array would look like this
          var fieldList:Array = ["All", "gender", "ageLg", "ageSm"];
          which would keep the lower items in order.

          I'll probably create a new groupingcollection class and add this functionality but if there's a simpler way that would be great.
          • 2. Re: ADG First Non Grouped Column order not preserved
            Level 7

            "oplin" <webforumsuser@macromedia.com> wrote in message
            news:gohb8u$8g9$1@forums.macromedia.com...
            > If the GroupingCollection allowed you to take the first non-grouped colum
            > and
            > use it as a sort this would work, in the method makeGroupedCollection, and
            > then
            > the fieldList array would look like this
            > var fieldList:Array = ["All", "gender", "ageLg", "ageSm"];
            > which would keep the lower items in order.
            >
            > I'll probably create a new groupingcollection class and add this
            > functionality
            > but if there's a simpler way that would be great.
            >

            GroupingCollection already contains everything you need. Check out this
            example:
            http://flexdiary.blogspot.com/2008/09/groupingcollection-example-featuring.html