Skip to main content
Participant
May 11, 2010
Question

How to set the backgroundcolor of a datagridcolumn

  • May 11, 2010
  • 1 reply
  • 574 views

Can somebody share an example on how to set the backgroundcolor of a datagridcolumn (dynamically)?

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
May 15, 2010

you can create a movieclip with that background characteristics you want, assign it a linkage and a class.  its class file should look like:

class CustomColumn1 extends MovieClip {
    var txtField:TextField;
    function CustomColumn1() {
    }
    function setValue(theValue:String, theItem:Object, selected:String):Void {
        txtField.text = theValue;
    }
}

and use that movieclip's linkage id in:

yourDG.getColumnAt(i).cellRenderer = "customColumn1ID";

Vanden_BAuthor
Participant
May 17, 2010

Thanks!

But can you explain the first step in more detail? About creating the mc and assign it a linkage ...

kglad
Community Expert
Community Expert
May 17, 2010

create (what will be a column background) rectangular movieclip.  say, 100x20.

right click it in the library and assign a linkage id that you assign to the cellRenderer property.