티스토리 뷰

import mx.charts.series.ColumnSeries;
import mx.controls.dataGridClasses.DataGridColumn;
import mx.controls.DataGrid;

// Creating the dataprovider
var myXML:XMLList = event.result.item;

// Creating the datagrid itself
var myGrid:DataGrid = new DataGrid;
  // Setting some properties
  myGrid.dataProvider = myXML;
  myGrid.width = 320;
  myGrid.rowCount = myXML.length();
  myGrid.rowHeight = 25;

// Creating the first column
var columnOne:DataGridColumn = new DataGridColumn;
  // Setting some properties
  columnOne.headerText = 'Column One';
  columnOne.width = 25;

// Creating the second column
var columnTwo:DataGridColumn = new DataGridColumn;
  // Setting properties
  columnTwo.headerText = 'Column Two';

// New array to hold the column information
var cols:Array = new Array;
  // Add the column information to the new array
  cols.push(columnOne);
  cols.push(columnTwo);

// Apply the array to the datagrid
myGrid.columns = cols;

// Add the datagrid to the workspace so it will display
mx.core.Application.application.addChild(myGrid); // In this case my datagrid was created inside a component, so I had to reference the parent when passing it.
유용하게 쓸수 있을듯
댓글