FLEX开发,在datagrid中使用渲染器显示combobox的问题 - IDC资讯网_站长学院 - Java PHP Flex Python Ajax CSS 编程 开源 学习 总结 分享
FLEX中使用itemRenderer和itemEditor调用父页面的方法使用关键字outerDocument调用的父页面方法必须是PUBLIC声明的方法
点击在新窗口中浏览此图片


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
 <![CDATA[
     import mx.collections.ArrayCollection;
 
     [Bindable]
     private var initDataGrid:ArrayCollection = new ArrayCollection([
        {Id:1001,city:"Shanghai",provice:"上海",total:580000},  
              {Id:1002,city:"Beijing",provice:"河北省",total:7852020},  
              {Id:1003,city:"Nanjing",provice:"江苏省",total:895145},  
              {Id:1004,city:"Hangzhou",provice:"浙江省",total:4132415},  
              {Id:1005,city:"Shanghai",provice:"上海",total:580000},  
              {Id:1006,city:"Beijing",provice:"河北省",total:7852020},  
              {Id:1007,city:"Nanjing",provice:"江苏省",total:895145},  
              {Id:1008,city:"Hangzhou",provice:"浙江省",total:4132415},  
              {Id:1009,city:"Shanghai",provice:"上海",total:580000},  
              {Id:1010,city:"Beijing",provice:"河北省",total:7852020},  
              {Id:1012,city:"Nanjing",provice:"江苏省",total:895145},  
              {Id:1013,city:"Hangzhou",provice:"浙江省",total:4132415}  
     ]);
     
     
     [Bindable]
     public var years:ArrayCollection = new ArrayCollection([
     {label:"2000", data:2000},
     {label:"2001",data:2001},
     {label:"2002",data:2002},
     {label:"2003",data:2003},
     {label:"2004",data:2004},
     {label:"2005",data:2005}]);    
 ]]>
</mx:Script>
   <mx:DataGrid id="myDataGrid" width="800" editable="true" dataProvider="{initDataGrid}">
     <mx:columns>          
       <mx:DataGridColumn headerText="Id" dataField="Id" editable="false" width="200"/>
       <mx:DataGridColumn headerText="city" dataField="city" editable="false" width="200"/>
       <mx:DataGridColumn headerText="provice" dataField="provice" editable="false" width="200"/>
       <mx:DataGridColumn headerText="total" dataField="total" editable="false" width="200"/>
       <mx:DataGridColumn headerText="Year" editable="true">
         <mx:itemEditor>                      
           <mx:Component>
             <mx:ComboBox width="130" labelField="label" dataProvider="{outerDocument.years}"
               selectedIndex="{data.flag}" change="{data.flag = selectedIndex}"/>                
           </mx:Component>
         </mx:itemEditor>          
       </mx:DataGridColumn>
     </mx:columns>
   </mx:DataGrid>  
</mx:Application>
编程语言 | 评论(0) | 引用(0) | 阅读(6338)