[flexcoders] Re: AdvancedDataGrid custom drawRowBackground with HierarchicalCollectionView

2010-05-27 Thread csmarvz
http://flexpearls.blogspot.com/2008/02/row-background-color-in.html

I'll give a try but there is no alpha in the solution above.



--- In flexcoders@yahoogroups.com, "valdhor"  wrote:
>
> Have you tried using an item renderer?
> 




[flexcoders] AdvancedDataGrid custom drawRowBackground with HierarchicalCollectionView

2010-05-25 Thread csmarvz
Hi,

I have to color the nodes shown in my adg. The code below do the job but 
the performances insanely decrease. Any idea how to improve it please?

Best regards,

Henry

override protected function drawRowBackground(s:Sprite, rowIndex:int,

  y:Number, height:Number, color:uint, 
dataIndex:int):void
{
//default background alpha
var alpha:Number = 1.0;
if (dataProvider is HierarchicalCollectionView)
{

var cursor:IViewCursor = 
dataProvider.createCursor();
var index:int=0;
// move on the current row
while (index < dataIndex)
{
index++;
cursor.moveNext();
}
// if the current row is a node, then set the 
color
// and the background alpha (the deeper, the 
darker)

if(dataProvider.source.canHaveChildren(cursor.current)){
color = 0x25e16d;
alpha = 
dataProvider.getNodeDepth(cursor.current) / 10;
if (alpha > 1) alpha = 1;
}
}

var background:Shape;
if (rowIndex < s.numChildren)
{
background = Shape(s.getChildAt(rowIndex));
}
else
{
background = new FlexShape();
background.name = "background";
s.addChild(background);
}

background.y = y;

// Height is usually as tall is the items in the row, 
but not if
// it would extend below the bottom of listContent
var height:Number = Math.min(height,
listContent.height -
y);

var displayWidth:int = unscaledWidth - 
viewMetrics.right - viewMetrics.left;
var g:Graphics = background.graphics;
g.clear();
g.beginFill(color, alpha);
g.drawRect(0, 0, displayWidth, height);
g.endFill();
}



[flexcoders] headerRenderer ComboBox

2010-02-23 Thread csmarvz
Hi,

Today, my question is : How to populate a ComboBox (as headerRender of an 
AdvanceDataGrid) with the rows of the corresponding column?

(and doing it inside of my custom ComboHeaderRenderer AS3 class to get 
something as generic as possible)

I saw a lot of samples of ComboHeader everywhere, but always filled with static 
data or in mxml style..

Regards!

Henry



[flexcoders] Re: AdvancedDataGrid's default columns

2010-02-18 Thread csmarvz
hello! yeah you're right :)

--- In flexcoders@yahoogroups.com, "tntomek"  wrote:
>
> Henry, manually setting up column fields takes probably 5 lines of code, 
> there really is no good reason other then for demos to show how easy it is to 
> bind grid to data to use the automatic feature. Since you are using custom 
> columns you must be doing something beyond that.



[flexcoders] styleFunction AdvancedDataGridColumn

2010-02-18 Thread csmarvz
Hi,

I have myCustomADGC that extends AdvancedDataGridColumn.

Where in myCustomADGC can I put something like :

if (styleFunction == null)
{
styleFunction = myStyleFunction;
}


and to be called one time? (like onCreationComplete)

(same question for headerRenderer and itemRenderer)

thanks!



[flexcoders] AdvancedDataGrid's default columns

2010-02-17 Thread csmarvz
Hi there,

is there a way to tell my custom AdvancedDataGrid to use my custom 
AdvancedDataGridColumn by default?

by default, I mean when set up my grid with a dataprovider without setting up 
the columns field (all fields'll be displayed).

Thanks!

Henry