7 Replies Latest reply on May 25, 2009 12:13 AM by karthik flex

    Scrolling Datagrid?

    karthik flex

      hi guys

       

      I have one doubt

       

      When i scroll my datagrid which contains huge data e.g 20 rows
      when i drag down and move up the datas are shuffling means
      the second row data is coming in first row and third row data is coming in second row

      please help

      --
      Karthik.k

        • 1. Re: Scrolling Datagrid?
          _Natasha_ Level 4

          Hi,

           

          do you use custom itemRenderers?

          • 2. Re: Scrolling Datagrid?
            Gregory Lafrance Level 6

            List based components like DataGrid recycle itemRenderers for improved performance, and you can have scrolling problems. See this link:

             

            http://devharbor.blogspot.com/2008/09/flex-itemrenderers-and-recycling-issues.html

             

            If this post answers your question or helps, please mark it as such.

            • 3. Re: Scrolling Datagrid?
              karthik flex Level 1

              hi Natasha

               

              Yes i am using itemRenderers?

               

              karthik.k

              • 4. Re: Scrolling Datagrid?
                Gregory Lafrance Level 6

                And using itemRenderers can cause problems with scrolling:

                 

                List based components like DataGrid recycle itemRenderers for improved performance, and you can have scrolling problems. See this link:

                 

                http://devharbor.blogspot.com/2008/09/flex-itemrenderers-and-recycling-issues.ht ml

                 

                If this post answers your question or helps, please mark it as such.

                • 5. Re: Scrolling Datagrid?
                  karthik flex Level 1

                  hi

                   

                  i am explaining in detail

                   

                  i have a datagrid and itemrenderer

                   

                  inside that itemrenderer i have data separated with commas
                  it is getting displayed like paragraph
                  but i need to split with comma and display one by one
                  I did the same separated by comma and displayed one below the other
                  it is getting displayed correctly
                  but when i scroll up and down, datas getting shuffled first data in last row when i scroll

                   

                  below is the itemrenderer i am using

                  override public function set data(value:Object):void
                      {
                          super.data=value;
                          textData.text=String(data[_

                  listData.dataField]);
                          textData.height=50;
                          textData.width=160
                          arr  = textData.text.split(",");
                           var box:VBox=new VBox();
                          for(var i:int=0;i<arr.length;i++)
                          {           
                              var text:Text = new Text();
                              text.text = arr[i].toString();
                                 box.addChild(text);
                                  this.addChild(box);
                             }         
                      }

                   

                  i am splitting data, adding to box, it is displaying correctly but when i do scrolling some thing strange occurs like
                  data shuffling what is the problem

                  should i need to do some thing else

                  please help

                  karthik.k
                  • 6. Re: Scrolling Datagrid?
                    _Natasha_ Level 4

                    Hi,

                    it seems to be many errors in your code.

                     

                    1. You have added box as a child several times. - It's not good. But it's not the reason of your problem.

                    2. You don't delete existing childs then data changed. Before string

                    var box:VBox=new VBox();

                    you should delete childs from previous call of this function. Something like this.removeAllChildren() or if you know the number of VBox this.removeChildAt(i) or if you save a reference to vbox this.removeChild(box). You don't clean it so you see old data then scrolling.

                    The best variant for you is to save link to your VBox and create it in createChildren method. In set data() function only clean children of this vbox and create new for new data.

                    • 7. Re: Scrolling Datagrid?
                      karthik flex Level 1

                      hi Natasha

                       

                      thank you

                       

                      you saved me i got it

                       

                      Thanks a lot

                       

                      karthik.k