4 Replies Latest reply on Jun 8, 2010 8:03 AM by Magesh1980

    Datagrid scrolling issue

    Magesh1980

      Hi All,

       

      I have a custom component which has two datagrid with items that can be moved between those two datagrids.

       

      And also the datagird items can be moved with in the datagrid to help ordering of the items.

       

      The issue is when i have more items in the datagrid (which brings the scroll bar to appear) and try to move items within the datagrid then when i scroll up and down it creates duplicate items with in the datagrid and creates empty rows(which can not be accessed) in to the datagrid.

       

      I am kind of hard time figuring out the issue.

       

      Is there any on experienced this issue or has any solutiong to it?

       

      Please let me know.

       

      Your help will be highly appreciated.

       

      Thanks.

        • 1. Re: Datagrid scrolling issue
          Flex harUI Adobe Employee

          Sounds like you're not handling recycling properly.  There is an old post on

          my blog about renderer recycling and plenty of forum topics

           

          --

          Alex Harui

          Flex SDK Team

          Adobe System, Inc.

          http://blogs.adobe.com/aharui

          • 2. Re: Datagrid scrolling issue
            Magesh1980 Level 1

            Alex,

             

            Thanks for your reply.

             

            I read your reply and blog. I had some functions that does change the color of the rows if its >10. And i changed the way you mentioned in the blog.

             

            override

             

             

             

             

             

            protected function drawRowBackground(s:Sprite, rowIndex:int, y:Number, height:Number, color:uint, dataIndex:int):

            void

            {

             

             

            var rowColor:uint;

             

            if (dataIndex >= 10 && hasMorethan10)

            {

            rowColor = hasMorethan10Color;

            }

             

            else

            {

            rowColor = color;

            }

             

             

            super.drawRowBackground(s, rowIndex, y, height, rowColor, dataIndex);

            }

             

             

            But still has the same issue ( duplicate rows and empty rows when i change the order of the items in the datagrid).

             

            I tried removing all the code that i wrote (like above mentioned function), and i still has the same issue.

             

            I could not figure out the reason yet.

             

            Any thoughts on this.

             

            Thanks,

             

            Magesh

            • 3. Re: Datagrid scrolling issue
              Flex harUI Adobe Employee

              Does your renderer handle recycling?  Is every visual aspect determined from

              the data property?  Post you renderer code if you're not sure.

              1 person found this helpful
              • 4. Re: Datagrid scrolling issue
                Magesh1980 Level 1

                Alex,

                 

                Thanks for your responses. I managed to figure out the issue i had.

                 

                Even though i handled the renderer recycling, it was still creating the same issues.

                 

                Its because i used the verticalScrollPostion value in datagrid based on the dataprovider length.

                 

                Once i removed that it started working properly.

                 

                I couldnt explain myself for a better explanation.

                 

                Let me know if you have any.

                 

                 

                Thanks for your support.

                 

                Magesh