Flex4 DataGrid中嵌入RadioButton實(shí)現(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頁(yè)面
<?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動(dòng)態(tài)生成可編輯的DataGrid具體實(shí)現(xiàn)代碼
DataGrid具有以下功能:表頭是動(dòng)態(tài)生成的、每行都是有序號(hào)的、每行都是可以編輯、插入、刪除、修改,接下來(lái)為大家分享下Flex如何動(dòng)態(tài)生成可編輯的DataGrid2013-04-04Flex 自定義DataGrid實(shí)現(xiàn)根據(jù)條目某一屬性值改變背景顏色
本節(jié)主要介紹了Flex DataGrid根據(jù)條目某一屬性值改變背景顏色,此DataGrid為自定義拓展的,需要的朋友可以參考下2014-07-07Flex播放器(實(shí)現(xiàn)播放、緩沖進(jìn)度條和音頻曲線顯示)
這篇文章主要介紹了Flex播放器(實(shí)現(xiàn)播放、緩沖進(jìn)度條和音頻曲線顯示),需要的朋友可以參考下2014-07-07Flex3 DataGrid拖拽到ClumnChart動(dòng)態(tài)顯示圖表實(shí)現(xiàn)代碼
Flex3 DataGrid拖拽到ClumnChart動(dòng)態(tài)顯示圖表(支持多行同時(shí)拖拽,重復(fù)數(shù)據(jù)不重得添加,添加了圖表右鍵菜單)等等,感興趣的朋友可以了解下啊,或許對(duì)你有所幫助2013-01-01利用R語(yǔ)言解壓與壓縮.tar.gz.zip等格式文件
這篇文章主要為大家介紹了利用R語(yǔ)言怎樣解壓與壓縮.tar.gz.zip等各種壓縮格式文件實(shí)現(xiàn)過(guò)程方法,有需要的朋友可以借鑒參考下希望能夠有所幫助2021-11-11如何在Renderer中設(shè)置屬性 Renderer中設(shè)置屬性的方法實(shí)例
如何在Renderer中設(shè)置屬性 Renderer中設(shè)置屬性的方法實(shí)例,需要的朋友可以參考一下2013-06-06在Flex中給datagrid添加右鍵菜單項(xiàng)的具體實(shí)現(xiàn)
Flex中如何給datagrid添加右鍵菜單項(xiàng),其實(shí)很簡(jiǎn)單,下面有個(gè)不錯(cuò)的教程,感興趣的朋友可以參考下2013-12-12