Flex4 DataGrid中如何嵌入RadioButton(flexform中国官网)深度揭秘

随心笔谈4个月前更新 admin
195 00
🌐 经济型:买域名、轻量云服务器、用途:游戏 网站等 《腾讯云》特点:特价机便宜 适合初学者用 点我优惠购买
🚀 拓展型:买域名、轻量云服务器、用途:游戏 网站等 《阿里云》特点:中档服务器便宜 域名备案事多 点我优惠购买
🛡️ 稳定型:买域名、轻量云服务器、用途:游戏 网站等 《西部数码》 特点:比上两家略贵但是稳定性超好事也少 点我优惠购买

文章摘要

这篇文章介绍了如何通过自定义组件实现Flex网格(Grid)中复选框(Radio Button)的选择状态控制。文章详细说明了如何在Grid的数据准备(prepare)事件中,通过检查selectedItems数组来确定复选框的选中状态,并将其绑定到数据行的选择状态上。代码中使用super.prepare方法调用父类的 prepare 函数,并通过检查selectedItems的索引来决定复选框是否为已选中状态。此外,文章指出复选框被禁用了,以防止用户直接点击操作。

xmlns:s=”library://ns.adobe.com/flex/spark”

xmlns:mx=”library://ns.adobe.com/flex/mx”>

//———————————————————————————————————-

override public function prepare(hasBeenRecycled:Boolean):void

{

super.prepare( hasBeenRecycled );

// We make the radio button mimic the selection status of the whole row.

const selected_items: Vector.=grid.dataGrid.selectedItems;

if( null==selected_items )

{

radio_button.selected=false;

return;

}

if( -1 !=selected_items.indexOf( data ) )

radio_button.selected=true;

else

radio_button.selected=false;

}

//———————————————————————————————————-

]]>

The “selected” property of the radio_button will be controlled by the “prepare” function.

The radio_button should not be allowed any user interaction. Hence disabling it.–>

label=””

enabled=”false”

horizontalCenter=”0″ verticalCenter=”0″ />

© 版权声明

相关文章