我如何使用Flex中的动态列在动态数据网格中添加图像项目

时间:2011-03-17 05:11:20

标签: flex actionscript-3 flex4

如何使用动作脚本在动态数据网格中使用Flex中的动态列添加带有图像的itemrenderer?

示例代码:

arrDatagridCol = obj.Tables.Table1.Columns; 

for each (var str:String in arrDatagridCol) 
{
  addDataGridColumn(str);
} 

dgRoleToFunctionality.dataProvider = RoleManagementModel.instance().roleToFunctionality;

private function addDataGridColumn(dataField:String):void 
{ 
  var dgc:DataGridColumn = new DataGridColumn(dataField); 
  dgc.dataField = dataField dgc.headerText = dataField.replace("x0020"," "); 
  dgc.itemRenderer = new ClassFactory(com.rmsi.ManagementTool.RoleManagement.Maps.itemRendererDatagrid); 
  var cols:Array = dgRoleToFunctionality.columns; cols.push(dgc); dgRoleToFunctionality.columns = cols; 
}

0 个答案:

没有答案