2 Replies Latest reply on May 5, 2010 2:39 AM by Peacemaker2000

    AdvancedDataGrid Scroll/Sort-Bug

    Peacemaker2000 Level 1

      Steps to reproduce:

      1. Scroll the datagrid to middle position.
      2. Sort by column "id".
      3. Change sort order from ascending to descending.

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600">
           <mx:Script>
           <![CDATA[
                import mx.collections.ArrayCollection;
                import mx.collections.HierarchicalData;
                public var testData:ArrayCollection = new ArrayCollection([
                     {id:1,children: [{id:11},{id:12},{id:13}]},
                     {id:2,children: [{id:21},{id:22},{id:23}]},
                     {id:3,children: [{id:31},{id:32},{id:33}]},
                     {id:4,children: [{id:41},{id:42},{id:43}]},
                     {id:5,children: [{id:51},{id:52},{id:53}]},
                     {id:6,children: [{id:61},{id:62},{id:63}]},
                     {id:7,children: [{id:71},{id:72},{id:73}]},
                     {id:8,children: [{id:81},{id:82},{id:83}]},
                     {id:9,children: [{id:91},{id:92},{id:93}]},
                     {id:10,children: [{id:101},{id:102},{id:103}]},
                     {id:11,children: [{id:111},{id:112},{id:113}]},
                     {id:12,children: [{id:121},{id:122},{id:123}]}
                ]);
           ]]>
           </mx:Script>
           
           <mx:AdvancedDataGrid width="400" height="200">
                <mx:dataProvider>
                     <mx:HierarchicalData source="{testData}" />
                </mx:dataProvider>
           </mx:AdvancedDataGrid>
       
      </mx:Application>
      
      
        • 1. Re: AdvancedDataGrid Scroll/Sort-Bug
          ramco9

          Hi,

           

          Please find the following code

           

           

           

           

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600">
               <mx:Script>
               <![CDATA[
                    import mx.collections.ArrayCollection;
                    import mx.collections.HierarchicalData;
                    public var testData:ArrayCollection = new ArrayCollection([
                         {id:1,children: [{id:11},{id:12},{id:13}]},
                         {id:2,children: [{id:21},{id:22},{id:23}]},
                         {id:3,children: [{id:31},{id:32},{id:33}]},
                         {id:4,children: [{id:41},{id:42},{id:43}]},
                         {id:5,children: [{id:51},{id:52},{id:53}]},
                         {id:6,children: [{id:61},{id:62},{id:63}]},
                         {id:7,children: [{id:71},{id:72},{id:73}]},
                         {id:8,children: [{id:81},{id:82},{id:83}]},
                         {id:9,children: [{id:91},{id:92},{id:93}]},
                         {id:10,children: [{id:101},{id:102},{id:103}]},
                         {id:11,children: [{id:111},{id:112},{id:113}]},
                         {id:12,children: [{id:121},{id:122},{id:123}]}
                    ]);
               ]]>

          private function sortNumeric(obj1:Object, obj2:Object):int {
                      var value1:Number = (obj1.id == '' || obj1.id == null) ? null : new Number(obj1.id);
                      var value2:Number = (obj2.id == '' || obj2.id == null) ? null : new Number(obj2.id);

                      if (value1 < value2) {
                         return -1;
                      } else if (value1 > value2) {
                        return 1;
                      } else {
                        return 0;
                      }
                   }

               </mx:Script>
              
               <mx:AdvancedDataGrid width="400" height="200">
                    <mx:dataProvider>
                         <mx:HierarchicalData source="{testData}" />
                    </mx:dataProvider>
                    <mx:columns>
                              <mx:Array>
                                  <mx:DataGridColumn dataField="id" headerText="id" sortCompareFunction="sortNumeric"/>
                                 
                              </mx:Array>
                          </mx:columns>
                      </mx:DataGrid>
               </mx:AdvancedDataGrid>

          </mx:Application>

           

           

          Thank you

          • 2. Re: AdvancedDataGrid Scroll/Sort-Bug
            Peacemaker2000 Level 1

            I'm sorry ... I should have written a little more about what the problem is, but I was posting it while knocking off work

             

            The actual problem is that the rows that are displayed by the AdvancedDataGrid get cluttered when I change the sort order from ascending to descending (or vice versa). If I do a little scrolling after that it even gets worse, the sort is completly out of order.

             

            After Step 2:

            before.jpg

             

            After Step 3:

            after.jpg

             

            Scrolling after Step 3:

            after_scroll.jpg