msukow
asked on
Datagrid and variable height
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();
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
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.