Using ActionScript 3.0 Components |
|
|
|
| Customizing the UI Components > Customizing the DataGrid > Using styles with the DataGrid > Setting header styles | |||
You can set the text style for a header row by using the headerTextFormat style. The following example uses the TextFormat object to set the headerTextFormat style to use the Arial font, the color red, a font size of 14, and italic.
To set the headerTextFormat style for a DataGrid;import fl.data.DataProvider;import fl.controls.dataGridClasses.DataGridColumn;var myDP:Array = new Array();myDP = [{FirstName:"Winston", LastName:"Elstad"},{FirstName:"Ric", LastName:"Dietrich"},{FirstName:"Ewing", LastName:"Canepa"},{FirstName:"Kevin", LastName:"Wade"},{FirstName:"Kimberly", LastName:"Dietrich"},{FirstName:"AJ", LastName:"Bilow"},{FirstName:"Chuck", LastName:"Yushan"},{FirstName:"John", LastName:"Roo"},];// Assign the data provider to the DataGrid to populate it.// Note: This has to be done before applying the cellRenderers.aDg.dataProvider = new DataProvider(myDP);aDg.setSize(160,190);aDg.move(40,40);aDg.columns[0].width = 80;aDg.columns[1].width = 80;var tf:TextFormat = new TextFormat();tf.size = 14;tf.color = 0xff0000;tf.italic = true;tf.font = "Arial"aDg.setStyle("headerTextFormat", tf);
|
|
|
|