Site Contents
Home
My Blog
ColdFusion
JRun
Flex
Wireless & Networking
Hardware & Gadgets
HDTV
Software Picks
Pictures
Contact Me
Search


My Articles & Papers
Flex Performance
Server/Client
mm.com Under the Hood
Multiple Instances of CFMX
Multiple Instance Config
NLB with ColdFusion
Clustering CFMX for J2EE
Multi-Tier Hardware LB w CFMX
Cisco CSS & Coldfusion MX
JRun 4 Jini based Clustering
WiFi Growth

2ID Tacweb

Other Hobbys
Body-For-Life Challenge

Personal Projects
Family Pool
Deck Gate

username:
password:
 

 
Building burcell.org

Welcome to bpurcell.org, the personal homepage of Brandon Purcell. I started building bpurcell.org many, many years ago to share information I ran across everyday in my role as a Support Engineer and Consultant for Macromedia/Adobe. As a support engineer and consultant I always had a lot to blog about but as I moved into managment roles at Adobe my technical content dwindled.

I currently work as the Director of Technology for Universal Mind. My primary responsiblity is managing the SpatialKey project and it has been an amazing experience. I have been spending a lot of time working with Amazon Ec2 and will share my experiences through the blog in the future. I truly believe that Cloud Computing is the IT platform of the future and we have built the SpatialKey architecture on top of Ec2.

Viewing Individual Entry / Main
March 17, 2005

I have heard this question many times and I don't think it is documented. If you want to change the color of an entire row within a Datagrid in Flex use the following code

dg.setPropertiesAt(2, {backgroundColor:0xFF0000});

Where dg is your datagrid and the first parameter is the row of number you want to change

Comments

Ok it is work if i use a button (for example). But i want to change the color of an entire row in accordance with data of dataProvider


It would be great if this was documented because it's very useful. Why isn't in LiveDocs?


How can I change it back to its original color after I've changed it dynamically? Also, how can I change the color of a chosen column? Thanks.


How to implement this in flex beta 2 ?


setPropertiesAt is not defined for DataGrid (I am getting Compiler error). I am using Flex 2 Beta 2.

Is there anyone know any other way to change background color of DG row and column for Flex 2?


I'm looking for a quick fix for this too -- there's some pretty long workarounds available, but I can't find any documented features for easily changing the row color.


Can't seem to find this in Flex 2 (release). Is there any equivalent approach available?


I am looking for this one too. There are solutions there but they seem to be quite elaborate and many deal with color changes in item renderers based on the data in the cell. I want to be able to change the color dynamically, on a click of another item. Could someone please post a solution if and when they find one...

Thanks in advance, Niyati


This is what I have been using and it works...a little long but effective.

<!--- onload function ---> function onFormLoad(){ var listener:Object = {}; //put the controls in scope to avoid calling _root var grdPassdown:mx.controls.DataGrid = grdPassdown; listener.modelChanged = function(evt):Void { <!--- remove listener, so that we are not longer notified of model changes ---> grdPassdown.removeEventListener('modelChanged',listener); <!--- select first item ---> var grdPassdown = grdPassdown; for(var i:Number = grdPassdown.length-1; i >= 0; i--) { var item:Object = grdPassdown.dataProvider[i]; grdPassdown.selectedIndex = i; if (grdPassdown.dataProvider[grdPassdown.selectedIndex]['EVNT_TYP']=='Clearance'){ if (grdPassdown.dataProvider[grdPassdown.selectedIndex]['DISPO']=='PENDING'){ grdPassdown.setPropertiesAt([i], {backgroundColor:0xF7FFB7}); } } if (grdPassdown.dataProvider[grdPassdown.selectedIndex]['EVNT_TYP']=='Reportable Incident'){ if (grdPassdown.dataProvider[grdPassdown.selectedIndex]['DISPO']=='PENDING'){ grdPassdown.setPropertiesAt([i], {backgroundColor:0xEE2C2C}); } } } grdPassdown.selectedIndex = undefined; } grdPassdown.addEventListener('modelChanged',listener); }

I got some of this code from other blogs and put it all together. Thanks to everyone who contributed.


This is an easy way to do this...not sure about performance impact however:

<mx:DataGridColumn dataField="name" sortable="false" headerText="Title"> <mx:itemRenderer> <mx:Component> <mx:Label opaqueBackground="{data.viewed > 0 ? '0xA2FEA2' : '0xFFFFFF'}" /> </mx:Component> </mx:itemRenderer>

</mx:DataGridColumn>


I found this site which offers a rather nice workaround to the problem by extending the DataGrid class

http://www.switchonthecode.com/tutorials/flex-datagrid-goodies-row-color-and-others

I hope this helps you guys!

Kind regards - Thomas


 

Calendar
SunMonTueWedThuFriSat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      

Subject Archives
Amazon EC2 (15)
ColdFusionMX (155)
Corvette (3)
Flash Lite (4)
Flash Media Server (5)
Flash Player (3)
Flex (39)
General Web Dev (14)
HDTV (3)
Jboss (1)
Jquery (2)
JRun (59)
Max 2003 (3)
Other (33)
PC Hardware (16)
Software (17)
SpatialKey (7)
Wireless (8)
Working Out (1)

Search
RSS Feed
Feed Listing

www.flickr.com
Corvette - October 2005 brandonpurcell's Corvette - October 2005 photoset
Macromedia ColdFusion MX

Featured Links
Stock Footage
Page Render Time:234 user:""