Flex datagrid itemrenderer刷新显示错乱问题

1.itemrenderer中控制按钮的显示和隐藏,datagrid水平滚动条拖动,itemrenderer显示错乱问题已解决,代码如下:

<mx:DataGridColumn headerText="操作" dataField="HANDLE_TAG">
						<mx:itemRenderer>
							<mx:Component>
								<mx:HBox horizontalAlign="center" horizontalGap="0">
									<mx:Script>
										<![CDATA[
											import mx.events.FlexEvent;
											override public function set data(value:Object):void
											{
												super.data=value;
												if(value.HANDLE_TAG=="1")
												{
													edit.visible=true;
													edit.includeInLayout=true;
													adjust.visible=false;
													adjust.includeInLayout=false;
													see.visible=false;
													see.includeInLayout=false;
												}
												else if(value.HANDLE_TAG=="2")
												{
													edit.visible=true;
													edit.includeInLayout=true;
													if(value.BANK_CODE=="ICBC"){
														adjust.visible=true;
														adjust.includeInLayout=true;
													}
													else{
														adjust.visible=false;
														adjust.includeInLayout=false;
													}
													see.visible=false;
													see.includeInLayout=false;
												}
												else if(value.HANDLE_TAG=="3")
												{
													see.visible=true;
													see.includeInLayout=true;
													adjust.visible=false;
													adjust.includeInLayout=false;
													edit.visible=false;
													edit.includeInLayout=false;
												}
												else{
													edit.visible=false;
													edit.includeInLayout=false;
													adjust.visible=false;
													adjust.includeInLayout=false;
													see.visible=false;
													see.includeInLayout=false;
												}
									   		}
										]]>
									</mx:Script>
									<mx:LinkButton id="edit" label="编辑" visible="false"
										textDecoration="underline" includeInLayout="false"
										click="outerDocument.editReconciliationBalance(data)"/>
									<mx:LinkButton id="adjust" label="调整​" visible="false"
										textDecoration="underline" includeInLayout="false"
										click="outerDocument.adjustmentTable(data)"/>
									<mx:LinkButton id="see" label="查看" visible="false"
										textDecoration="underline" includeInLayout="false"
										click="outerDocument.showBalance(data)"/>
								</mx:HBox>
							</mx:Component>
						</mx:itemRenderer>
					</mx:DataGridColumn>

2.itemrenderer中控制label,不同内容显示不同颜色,水平滚动条拖动问题已解决,例子如下:

<mx:DataGridColumn headerText="银行对账余额" dataField="BANK_BALANCE_RECONCILIATION">
						<mx:itemRenderer>
							<mx:Component>
								<mx:Label text="{data.BANK_BALANCE_RECONCILIATION}">
									<mx:Script>
										<![CDATA[
											override public function set data(value:Object):void
											{
												super.data=value;
												if(value.BANK_CODE=="ICBC")
												{
													setStyle("color","green");
												}
												else{
													setStyle("color","black");
												}
											}
											override protected function updateDisplayList(unscaledWidth:Number,unscaledHeight:Number):void{
												super.updateDisplayList(unscaledWidth,unscaledHeight);
												if(data.BANK_CODE=="ICBC")
												{
													setStyle("color","green");
												}
												else{
													setStyle("color","black");
												}
            								}
										]]>
									</mx:Script>
								</mx:Label>
								<!--
								<mx:HBox horizontalAlign="center">
									<mx:Script>
										<![CDATA[
											override public function set data(value:Object):void
											{
												super.data=value;
												if(value.BANK_CODE=="ICBC")
												{
													bbr.setStyle("color","green");
												}
												bbr.text=value.BANK_BALANCE_RECONCILIATION;
											}
										]]>
									</mx:Script>
									<mx:Label id="bbr"/>
								</mx:HBox>
								-->
							</mx:Component>
						</mx:itemRenderer>
					</mx:DataGridColumn>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值