Flex4 DataGrid中如何嵌入RadioButton
更新時(shí)間:2013年12月30日 17:57:48 作者:
本文為大家介紹下Flex4 DataGrid中嵌入RadioButton的方法,下面有個(gè)不錯(cuò)的示例,感興趣的朋友可以參考下
復(fù)制代碼 代碼如下:
<s:DataGrid id="viewDg" width="100%" height="100%" fontFamily="微軟雅黑"
horizontalScrollPolicy="off" borderVisible="false"
dataProvider="{viewList}">
<s:columns>
<s:ArrayList>
<s:GridColumn width="{wid*0.02}" resizable="false"
itemRenderer="Module_SchoolView.RadioButtonGridItemRenderer"/>
<s:GridColumn width="{wid*0.25}" headerText="名稱" dataField="xysj02" resizable="false"/>
<s:GridColumn width="{wid*0.25}" headerText="地名" dataField="xysj02name" resizable="false"/>
<s:GridColumn width="{wid*0.35}" headerText="URL" dataField="xysj04" resizable="false"/>
<s:GridColumn width="{wid*0.13}" headerText="備注" dataField="xysj05" resizable="false"/>
</s:ArrayList>
</s:columns>
</s:DataGrid>
MXML頁面
復(fù)制代碼 代碼如下:
<?xml version="1.0" encoding="utf-8"?>
<s:GridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Declarations>
<!-- 將非可視元素(例如服務(wù)、值對(duì)象)放在此處 -->
</fx:Declarations>
<fx:Script>
<![CDATA[
//----------------------------------------------------------------------------------------------------------
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.<Object> = 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;
}
//----------------------------------------------------------------------------------------------------------
]]>
</fx:Script>
<!--The radio button is only a visual indicator for whether the row is selected or not.
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.-->
<s:RadioButton id="radio_button"
label=""
enabled="false"
horizontalCenter="0" verticalCenter="0" />
</s:GridItemRenderer>
相關(guān)文章
Flex中TextInput組件設(shè)置限制某些字符的輸入的方法
TextInput組件設(shè)置限制輸入例如限制某個(gè)字符的輸入、設(shè)置只能輸入某些字符等等,下面是具體的示例,喜歡的朋友可以參考下2014-01-01使用flex中的httpservice方法與java進(jìn)行交互
這篇文章主要介紹了使用flex中的httpservice方法與java進(jìn)行交互,需要的朋友可以參考下2014-02-02Flex tree加虛線顯示效果并且替代原始圖標(biāo)
Flex tree修改默認(rèn)圖標(biāo)并且加虛線顯示效果,實(shí)在是看不下去那種巨丑無比的小箭頭+文件夾的顯示方式,具體實(shí)現(xiàn)如下,有此需求的朋友可以參考下,希望對(duì)家有所幫助2013-08-08如何在Renderer中設(shè)置屬性 Renderer中設(shè)置屬性的方法實(shí)例
如何在Renderer中設(shè)置屬性 Renderer中設(shè)置屬性的方法實(shí)例,需要的朋友可以參考一下2013-06-06Flex中在Tree綁定數(shù)據(jù)后自動(dòng)展開樹節(jié)點(diǎn)的方法
使用Tree組件在綁定數(shù)據(jù)后自動(dòng)展開所有樹型節(jié)點(diǎn)(不需要用戶再自己點(diǎn)擊展開節(jié)點(diǎn),會(huì)方 便許多),接下來為大家介紹下具體的實(shí)現(xiàn)2014-01-01Flex中如何動(dòng)態(tài)生成DataGrid以及動(dòng)態(tài)生成表頭
因某些需要,DataGrid及其表頭需要?jiǎng)討B(tài)生成,網(wǎng)上的解決方案打多籠統(tǒng),下面有個(gè)不錯(cuò)的解決方法,感興趣的朋友可以參考下2013-10-10