Hello,
I want to draw horizontal separators between rows with different line
colors depending on the row data.
I tried to use optimized item renderers but the performance was still
too slow during vertical scrolling.
I also tried to extend AdvancedDatagridItemRenderer and set border at
true. But I couldn't choose border sides and I only want a border on the
bottom side.
Next I attempted to override the drawHorizontalLine method from
AdvancedDatagrid class:
drawHorizontalLine is called from drawHorizontalSeparators().

override protected function drawHorizontalLine(s:Sprite, rowIndex:int,
color:uint, y:Number):void {
     if(indexToItemRenderer(rowIndex) != null) {
         var myObj:Object = indexToItemRenderer(rowIndex).data;
         var g:Graphics = s.graphics;
         if (myObj.name == "John") {
             g.lineStyle(1, 0x0000ff);
             g.moveTo(0, y);
             g.lineTo(width, y);
         } else {
             g.lineStyle(1, 0x000000);
             g.moveTo(0, y);
             g.lineTo(width, y);
         }
     }
}

The first display is correct. But after a vertical scroll, horizontal
lines keep their position and are not redrawn no matter what the row is,
because drawHorizontalSeparators() is not recalled.
So I tried to call drawHorizontalSeparators() on Scroll event: failure,
separator lines on top and bottom rows disappear during the vertical
scroll.

Is there a way I can draw different horizontal separators depending on
data without using item renderers?

Thanks in advance.

Sophany

Reply via email to