datagrid 简单替换

Posted on 2009-09-10 21:32 bruce.peng 阅读(231) 评论(0)  编辑  收藏 所属分类: flex
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
   xmlns:mx="http://www.adobe.com/2006/mxml"
   layout="vertical"
   creationComplete="setDataProvider()">
 
   <mx:Script>
      <![CDATA[
         import mx.collections.XMLListCollection;
        
         [Bindable]
         private var xmlOriginal : XML =
            <root>
               <item name="Alpha" letter="Z"/>
               <item name="Beta" letter="P"/>
               <item name="Gamma" letter="X"/>
               <item name="Delta" letter="P"/>
            </root>
           
         private var xmlUpdated : XML =
            <root>
               <item name="Alpha" letter="F"/>
               <item name="Beta" letter="U"/>
               <item name="Gamma" letter="A"/>
               <item name="Delta" letter="P"/>
               <item name="Epsilon" letter="F"/>
            </root>  
        
         private function setDataProvider() : void
         {
            dataGrid.dataProvider = new XMLListCollection( xmlOriginal..item );
         }
        
      ]]>
   </mx:Script>
 
   <mx:DataGrid
      id="dataGrid"/>
 
   <mx:Button
      label="Simulate Update"
      click="XMLListCollection( dataGrid.dataProvider ).source = xmlUpdated..item"/>
 
</mx:Application>

简单替换

只有注册用户登录后才能发表评论。


网站导航: