主頁(yè) > 知識(shí)庫(kù) > Flex4 DataGrid中嵌入RadioButton實(shí)現(xiàn)思路及代碼

Flex4 DataGrid中嵌入RadioButton實(shí)現(xiàn)思路及代碼

熱門標(biāo)簽:鐵路電話系統(tǒng) 銀行業(yè)務(wù) 呼叫中心市場(chǎng)需求 智能手機(jī) 網(wǎng)站文章發(fā)布 美圖手機(jī) 檢查注冊(cè)表項(xiàng) 服務(wù)器配置
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>
您可能感興趣的文章:
  • Flex 獲取每月第幾周小例子
  • Flex 遍歷Object鍵和值的示例代碼
  • Flex DataGrid 偽合并單元格實(shí)現(xiàn)思路
  • Flex 自定義DataGrid實(shí)現(xiàn)根據(jù)條目某一屬性值改變背景顏色
  • flex 遍歷Object對(duì)象內(nèi)容的實(shí)現(xiàn)代碼
  • 全面了解flex的用途

標(biāo)簽:紅河 樂(lè)山 新疆 河南 長(zhǎng)治 滄州 上海 沈陽(yáng)

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Flex4 DataGrid中嵌入RadioButton實(shí)現(xiàn)思路及代碼》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266