Flex4 DataGrid中嵌入RadioButton實現(xiàn)思路及代碼
更新時間:2014年07月27日 14:41:24 投稿:whsnow
本節(jié)主要介紹了Flex4 DataGrid中嵌入RadioButton實現(xiàn)思路及代碼,需要的朋友可以參考下
<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頁面
<?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ù)、值對象)放在此處 -->
</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實現(xiàn)雙軸組合圖的設(shè)計思路及代碼
組合圖是有柱狀圖和折線圖組合的,柱狀圖顯示的數(shù)據(jù)是依據(jù)左邊的豎直軸,折線圖的數(shù)據(jù)依據(jù)右邊的豎直軸,詳細(xì)實現(xiàn)請看本文,希望對大家有所幫助2013-09-09
Flex打開新窗口將主窗口數(shù)據(jù)傳給子窗口然后返回
主窗口打開子窗口,主窗口有數(shù)據(jù)傳給打開的子窗口,子窗口關(guān)閉時直接返回主窗口,具體的實現(xiàn)如下,感興趣的朋友可以參考2013-12-12
flex壓縮圖片exif信息(作者/相機(jī))丟失問題解決
使用flex的jpegencoder對圖片進(jìn)行壓縮的時候,exif信息會丟失這一點確實令人郁悶啊,此問題應(yīng)當(dāng)如何解決呢?經(jīng)研究jpeg的文檔,最終解決這個問題,曬出來與大家分享希望可以幫助到你們2013-02-02
flex chrome瀏覽器調(diào)試出現(xiàn)空白的解決方法
flex瀏覽器調(diào)試出現(xiàn)空白,原因是谷歌有個默認(rèn)的flash播放器,只要將默認(rèn)的播放器禁用,留下新安裝的插件,就OK了2014-02-02

