/**
THIS DOWNLOAD INCLUDES:
1) This html and swf file
2) The DataGrid Extensions MXP, SWC, and MXI files
3) PDF Documentation showing all available API functions, as well as a simple example
ACKNOWLEDGEMENTS:
Special thanks goes out to Eugene (eugene_minsk@inbox.ru) and Andrij (ruansoft@mail.ru)
for their great coding assistance in these DataGrid extensions!
*/
// THE CODE BEHIND THIS EXAMPLE...
myDP = new Array();
// NOTE: 17 "myDP.push( new Array(...) )" statements are here, to populate the DataGrid
myGrid.dataProvider = myDP;
myGrid.getColumnAt(0).headerText = "Company Name";
myGrid.getColumnAt(1).headerText = "Contact Name";
myGrid.getColumnAt(2).headerText = "Contact Title";
myGrid.getColumnAt(3).headerText = "Address";
myGrid.getColumnAt(4).headerText = "City";
myGrid.getColumnAt(5).headerText = "Country";
myGrid.getColumnAt(6).headerText = "Dividend in last 2003 year";
myGrid.editable = true;
//Header background of the column. Sets the background color of the DataGrid header.
myGrid.getColumnAt(0).setStyleProperty("headerBG", 0xFFCC55);
//The "displayPrefix" displayed a string before the data, and "displayPostfix" displays a string immediately after the data.
myGrid.getColumnAt(6).setStyleProperty( "displayPrefix", "$" );
myGrid.getColumnAt(6).setStyleProperty( "displayPostfix", ",00" );
//Show/hide horizontal gridlines. Allows horizontal gridlines to be shown or hidden.
myGrid.showHorizontalGridLines(true);
//Word wrap / autosize. "headerWordWrap" allows the text within the header to wrap. "autoSizeRows" allows the cell text to wrap (in a manner similar to how HTML text wraps in
tags).
myGrid.setStyleProperty( "headerWordWrap", true);
myGrid.setStyleProperty( "WordWrap", true );
//Nowrap option for single column
//myGrid.getColumnAt(1).setStyleProperty( "noWrap", true );
//Hide header separator. Allows the header separator to be hidden for any column (the small bar which separates the headers).
myGrid.getColumnAt(1).setStyleProperty( "showHeaderSeparator", false );
//Set column text property
var tf = new TextFormat();
tf.italic = true;
tf.bold = true;
tf.align = "center";
myGrid.getColumnAt(1).setStyleProperty( "textFormat", tf );
//set editable cell color
myGrid.setStyleProperty( "editableBackgroundColor", 0xE3F4FF);
//set header autosize
myGrid.setStyleProperty( "gridHeightAutosizing", false );
//Manual header height. This allows the height of the header to be set to any specific values, in pixels.
//NOTE if is used setStyleProperty( "headerWordWrap", true); header have auto height
myGrid.setStyleProperty( "headerHeight", 85 );
//make first column html draven
myGrid.getColumnAt(0).setStyleProperty( "htmlDrawing", true);
//set new text format for header
myGrid.getColumnAt(1).setStyleProperty( "headerTextFormat", tf);
tf = new TextFormat;
tf.bold = true;
tf.align = "center";
myGrid.getColumnAt(0).setStyleProperty( "headerTextFormat", tf);
myGrid.getColumnAt(0).width = 180;
var w = (myGrid.width - myGrid.getColumnAt(0).width)/(myGrid.columnCount-1);
for(var i=1; i < myGrid.columnCount; i++)
myGrid.getColumnAt(i).width = w;
stop();