0

谁能告诉我如何在 flex 的 datagrid 的不同列中显示对象的不同属性?

4

1 回答 1

0

您是否尝试过阅读 flex DataGrid 的基本帮助页面?

http://livedocs.adobe.com/flex/3/html/help.html?content=dpcontrols_6.html

这是来自实时文档的示例:

<?xml version="1.0"?>
<!-- dpcontrols/DataGridVisibleColumn.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" >
   <mx:DataGrid id="myDG" width="350"> 
      <mx:dataProvider>
         <mx:ArrayCollection>
            <mx:source>
               <mx:Object Artist="Pavement" Price="11.99" 
                  Album="Slanted and Enchanted" />
               <mx:Object Artist="Pavement" 
                  Album="Brighten the Corners" Price="11.99" />
            </mx:source>
         </mx:ArrayCollection>
      </mx:dataProvider>
      <mx:columns>
         <mx:DataGridColumn dataField="Artist" />
         <mx:DataGridColumn dataField="Album" />
         <mx:DataGridColumn id="price" dataField="Price" visible="false"/>
      </mx:columns>
   </mx:DataGrid>

   <!-- The column id property specifies the column to show.-->
   <mx:Button label="Toggle Price Column" 
      click="price.visible = !price.visible;" />
</mx:Application> 
于 2012-06-19T14:19:08.500 回答