3 Replies Latest reply on Jun 9, 2010 7:42 AM by Magesh1980

    datagrid horizontalGridLines

    Craig Grummitt Level 3
      i have a datagrid with custom itemRenderers that permit multi-line textboxes. the datagrid is set to have a variableRowHeight of true, and it has a style of horizontalGridLines set to true. when the content of the grid necessitates a vertical scrollbar, is when the problems appear. the grid lines don't appear to move from where they appear initially. scrolling doesn't affect them. alternating item colours still works okay, so i've implemented a temporary and satisfactory solution using this technique, however i am curious to know whether anyone else is familiar with this problem, and whether they know if its a problem with my approach, or a flex bug.
        • 1. Re: datagrid horizontalGridLines
          peterent Level 2
          This is a known problem with the DataGrid. The work-around is as follows:

          Create a new class which extends DataGrid. In that class, override the set verticalPosition function:

          override public function set verticalPosition( value:Number ) : void
          drawLinesAndColumnBackgrounds(); // forces lines to be redrawn
          super.verticalPosition = value;

          • 2. datagrid horizontalGridLines
            Craig Grummitt Level 3
            brilliant! thanks again for your assistance peter.

            the only comment on your code is that i think you meant verticalScrollPosition rather than verticalPosition. (see below for amended code, anyone else who's experiencing this problem)

            as a side issue, i'm curious to know how i can go about finding flex 'known problems' myself. i googled many combinations to find knowledge out there related to this problem and couldn't find anything.


            override public function set verticalScrollPosition( value:Number ) : void
            drawLinesAndColumnBackgrounds(); // forces lines to be redrawn
            super.verticalScrollPosition = value;
            • 3. Re: datagrid horizontalGridLines



              I saw your post here. I thought may be you could help me on a problem related to this.


              I have a  datagrid that should display the 10th horizontalGridLine to be of Red color.


              I used the following function to draw a line.


              override protected function drawHorizontalLine(s:Sprite, rowIndex:int, color:uint, y:Number):void{

              ///if row number is 10

              if(rowIndex == 10){

              color = 0xFFFF0000;//Red color


              super.drawHorizontalLine(s, rowIndex, color, y);



              But when i scroll down the line appears to stay there. I want that line to be moving.


              Is there a way i can do that?


              Your help on this highly appreciated.