PDA

View Full Version : [AS3] ItemRenderer list of Datagrid or DatagridColumn


babbu
09-29-2008, 02:52 PM
Ok ... my question is simple. I want to access to an ItemRenderer through Datagrid object or DataGridColumn object. I need to compare 2 dataprovider and I need to color a line if the command ( in my case it’s for a list of orders ) is new , if the quantity have changed or if the order have moved. I need to color the line dynamically. I know I can color the line by creating a subclass of a itemrenderer and override the draw function but it's it not the right method for what I need to do. I don't want to do it like that. I want to know how to access the childItem array( ItemRenderer in my case ). I know I can access it on click event of the datagrid with the event.target property.

babbu
09-29-2008, 03:44 PM
LOL again i found my solution. LOL it make me laught because i always found it 30 minutes after I post. Ok ... in my problen I saw a lot of people doing this ( colorizing datagrid ) with css or doing it by overriding function. I done it by creating a new class that extends datagrid. I saw in the LiveDoc of adobe listItems it's a private array of arrays of itemrenderer. Hehe exacly what i wanted. I simply wrote a public function to colorize the line and it work perfectly. I will put the code here soon for those who search a lot like me :P
I'm starting in As3 and found exacly what i need is hard some time. Ty myself for this solution :P

P.S. : Im a French Canadian and i don't realy practice my english exept on forum like this. Excuse me if I do mistakes.

babbu
09-29-2008, 03:51 PM
package
{
import mx.controls.DataGrid;

public class DataGridColor extends DataGrid
{
public function DataGridColor()
{
}

public function setColorLine(index:Number , color:String):void
{
for each (var temp:Object in this.listItems[index])
{
temp.setStyle("color" , color);
}
}
}
}

piersbravery
03-25-2009, 06:03 PM
Salut,

Ive been trying to use the function to change row colours but dont know how. Can you tell me how to call the function from within my Flash application. Thanks.

Piers