[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 541
  • Last Modified:

Format specific cells or specific rows of a datagrid component.

Seems simple, but I can't figure this out.

Is there any way in AS2 to format a specific cell of a datagrid component? So, let's say I want to make cell 2,4 bold with green text?

If this isn't possibble, or difficult, I could settle with formatting a specific row as such? For example, set row 3 to be bold with green text.
0
crickeys
Asked:
crickeys
  • 2
  • 2
2 Solutions
 
Aneesh ChopraCommented:
Indeed it is possible using CellRenderer Class.

Using CellRenderer class, we can apply complete HTML formatting (supported by flash for any textField) to any cell of DataGrid

here is an example with source files:
http://philflash.inway.fr/htmlrdtip1/htmlrdtip1.zip

you can see the possibilities here
0
 
crickeysAuthor Commented:
That looks interesting but if I use the following code, the myHtmlFunction never gets fired?
myHtmlFunction = function (itemObj:Object, columnName:String) {
 
	trace("fired");
	
}
 
// --- DataGrid columns ---
userList_lb.columnNames = ["name"];
 
var col:mx.controls.gridclasses.DataGridColumn;
var totalWidth:Number = 0;	
 
col = userList_lb.getColumnAt(0);
 
col.headerText = "Image 1";
col.cellRenderer = "HtmlCellRenderer";
col["htmlFunction"] = myHtmlFunction;

Open in new window

0
 
Aneesh ChopraCommented:
Have you copied "HtmlCellRenderer" into your library or not..?
0
 
crickeysAuthor Commented:
That was it, thanks.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now