Flex4之DataGrid之ComboBox渲染器

本文详细介绍了在Flex4中使用DataGrid组件结合ComboBox实现多项选择操作的方法,包括ItemRender的使用、组件嵌套及数据源的配置。

在使用dataGrid时候,有时候会用到渲染器,比如我要使用comboBox做多项选择操作,我就要用到ItemRender.

在flex4中我使用<fx:compoment>嵌入<mx:comboBox>组件。

代码如下:

<mx:itemEditor>                      
					<fx:Component>
						<mx:ComboBox width="130" labelField="label" dataProvider="{outerDocument.dayTypeArr}" 
									 selectedIndex="{data.flag}" change="{data.flag = selectedIndex}"/>                
					</fx:Component>
				</mx:itemEditor>     

当然这个部分还要加到DataGrid中去。

<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:XXX>                      
					
						。。。。。。。。。。。。。。。。。。
					
				</mx:XXX>          
			</mx:DataGridColumn>
		</mx:columns>
	</mx:DataGrid>  

数据源我这里使dayTypeArr

如下所示:

[Bindable]
public var dayTypeArr:ArrayCollection = new ArrayCollection( 
	[ 
		{label:"工作日", data:1},  
		{label:"公休日", data:2},  
		{label:"节假日", data:3} 
	]); 

(待续....)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值