?
Solved

Datagrid and variable height

Posted on 2008-11-05
2
Medium Priority
?
499 Views
Last Modified: 2013-11-11
I am trying to dynamically adjust the height of each row depending on the amount of text there is. Is this something only AS3 or Flex can do? Or am I missing something?
function dataGridFunction() {
 
	var characters:Array = new Array(new Array("01", "Jerry Jerry Jerry Jerry Jerry", "Seinfeld Seinfeld Seinfeld Seinfeld Seinfeld Seinfeld Seinfeld Seinfeld Seinfeld Seinfeld"), new Array("02", "Elaine", "Benes"), new Array("03", "Cosmo", "Kramer"), new Array("04", "Jocopo", "Peterman"), new Array("05", "Lloyd", "Braun"), new Array("06", "Estelle", "Costanza"), new Array("06", "George", "Costanza"), new Array("08", "Frank", "Costanza"), new Array("09", "David", "Puddy"), new Array("10", "Mickey", "Abbott"), new Array("11", "Morty", "Seinfeld"), new Array("12", "Helen", "Seinfeld"));
	//
	for (var i:Number = 0; i<characters.length; i++) {
		var id:String = characters[i][0];// I added this field
		var firstName:String = characters[i][1];
		var lastName:String = characters[i][2];
		dataGridMain.addItem({ID:id, First:firstName, Last:lastName});
	}
	//
		dataGridMain.variableRowHeight = true;
	dataGridMain.wordWrap = true;
	//
	dataGridMain.setStyle("fontFamily","Verdana");
	dataGridMain.setStyle("headerColor","0xA6CBDD");
	dataGridMain.setStyle("alternatingRowColors",["0xF0F0F0", "0xFFFFFF"]);
	dataGridMain.setStyle("rollOverColor","0xDCEBF1");
	dataGridMain.setStyle("selectionColor","0x5ec40b");// was 0xFFF97D
	dataGridMain.setStyle("selectionDuration",300);
	//
 
 
}
dataGridFunction();

Open in new window

0
Comment
Question by:msukow
  • 2
2 Comments
 
LVL 39

Expert Comment

by:blue-genie
ID: 22894159
i think what you're looking for is the CellRenderer.
have a look in the help file - there's explanations on how it works and some samples on how to create multiline cells so i think that should resize according to the content.
haven't tried it myself but its worth a shot.
0
 
LVL 39

Accepted Solution

by:
blue-genie earned 2000 total points
ID: 22894180
oh wait, i just read this in the help file.
as you know the DataGrid extends the list

" The following are some fundamental assumptions and requirements that Adobe used when developing the List class:


Lists have uniform row heights.
Every row must be the same height; the height can be set during authoring or at runtime.

Lists must scale to thousands of records.
Lists don't measure text.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question