![]() |
|
||||||||||
|
|||||
|
Регистрация: Apr 2011
Сообщений: 5
|
Здравствуйте. Помогите пожалуйста. В хэлпе есть скрипт:
http://help.adobe.com/ru_RU/ActionSc...5b32-7f4a.html /* This is a simple cell renderer example.It invokes the MultiLineCell cell renderer to display a multiple line text field in one of a DataGrid's columns. */ import fl.controls.DataGrid; import fl.controls.dataGridClasses.DataGridColumn; import fl.data.DataProvider; import fl.controls.ScrollPolicy; // Create a new DataGrid component instance. var aDg:DataGrid = new DataGrid(); var aLongString:String = "An example of a cell renderer class that displays a multiple line TextField" var myDP:Array = new Array(); myDP = [{firstName:"Winston", lastName:"Elstad", note:aLongString, item:100}, {firstName:"Ric", lastName:"Dietrich", note:aLongString, item:101}, {firstName:"Ewing", lastName:"Canepa", note:aLongString, item:102}, {firstName:"Kevin", lastName:"Wade", note:aLongString, item:103}, {firstName:"Kimberly", lastName:"Dietrich", note:aLongString, item:104}, {firstName:"AJ", lastName:"Bilow", note:aLongString, item:105}, {firstName:"Chuck", lastName:"Yushan", note:aLongString, item:106}, {firstName:"John", lastName:"Roo", note:aLongString, item:107}, ]; // 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); /* Set some basic grid properties. Note: The data grid's row height should reflect the number of lines you expect to show in the multiline cell. The cell renderer wil size to the row height. About 40 for 2 lines or 60 for 3 lines.*/ aDg.columns = ["firstName", "lastName", "note", "item"]; aDg.setSize(430,190); aDg.move(40,40); aDg.rowHeight = 40;// Allows for 2 lines of text at default text size. aDg.columns[0].width = 70; aDg.columns[1].width = 70; aDg.columns[2].width = 230; aDg.columns[3].width = 60; aDg.resizableColumns = true; aDg.verticalScrollPolicy = ScrollPolicy.AUTO; addChild(aDg); // Assign cellRenderers. var col3:DataGridColumn = new DataGridColumn(); col3 = aDg.getColumnAt(2); col3.cellRenderer = MultiLineCell; package { import fl.controls.listClasses.CellRenderer; public class MultiLineCell extends CellRenderer { public function MultiLineCell() { textField.wordWrap = true; textField.autoSize = "left"; } override protected function drawLayout():void { textField.width = this.width; super.drawLayout(); } } } |
|
|||||
|
Регистрация: Nov 2009
Адрес: в златоглавой
Сообщений: 745
|
: )
var col1:DataGridColumn = new DataGridColumn(); col1 = aDg.getColumnAt(0); col1.cellRenderer = MultiLineCell; var col2:DataGridColumn = new DataGridColumn(); col2 = aDg.getColumnAt(1); col2.cellRenderer = MultiLineCell; var col3:DataGridColumn = new DataGridColumn(); col3 = aDg.getColumnAt(2); col3.cellRenderer = MultiLineCell;
__________________
Нормально делай — нормально будет! |
|
|||||
|
Регистрация: Apr 2011
Сообщений: 5
|
Спасибо) А имена столбцов (шапка таблицы) как таким образом отформатировать?
|
![]() |
![]() |
Часовой пояс GMT +4, время: 12:44. |
|
|
« Предыдущая тема | Следующая тема » |
|
|