Flex4 DataGrid中嵌入RadioButton實現(xiàn)思路及代碼
來源:本站原創(chuàng)|時間:2020-01-11|欄目:Flex|點擊: 次
<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>
<!-- 將非可視元素(例如服務、值對象)放在此處 -->
</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小技巧之加載GIF圖片
本文標題:Flex4 DataGrid中嵌入RadioButton實現(xiàn)思路及代碼
本文地址:http://www.jygsgssxh.com/a1/Flex/11568.html
您可能感興趣的文章
- 01-11flex調(diào)用webservice中的自定義類的方法
- 01-11datagrid不可編輯行有關問題的控制方法
- 01-11Flex中在Tree綁定數(shù)據(jù)后自動展開樹節(jié)點的方法
- 01-11Flex中通過RadioButton進行切換示例代碼
- 01-11Flex中TabNavigator設置Tabs樣式思路及源碼
- 01-11獲取到AdvancedDataGrid選中行的全部數(shù)據(jù)
- 01-11Flex中TextInput組件設置限制某些字符的輸入的方法
- 01-11Flex中如何判斷是否在組件之外單擊
- 01-11使用flex中的httpservice方法與java進行交互
- 01-11Flex中TitleWindow傳值思路及實現(xiàn)


閱讀排行
本欄相關
- 01-11flex調(diào)用webservice中的自定義類的方法
- 01-11Flex實現(xiàn)的上傳攝像頭拍照并將UI保存
- 01-11datagrid不可編輯行有關問題的控制方法
- 01-11Flex控制彈出窗口拖動范圍示例代碼
- 01-11flex利用webservice上傳照片實現(xiàn)代碼
- 01-11Flex字體加粗問題只能對英文的字體加
- 01-11Flex中在Tree綁定數(shù)據(jù)后自動展開樹節(jié)點
- 01-11flex內(nèi)嵌html網(wǎng)頁示例代碼
- 01-11Flex中通過RadioButton進行切換示例代碼
- 01-11Flex彈出窗口請求Action函數(shù)示例
隨機閱讀
- 08-05DEDE織夢data目錄下的sessions文件夾有什
- 01-10delphi制作wav文件的方法
- 01-10SublimeText編譯C開發(fā)環(huán)境設置
- 01-11Mac OSX 打開原生自帶讀寫NTFS功能(圖文
- 08-05dedecms(織夢)副欄目數(shù)量限制代碼修改
- 01-11ajax實現(xiàn)頁面的局部加載
- 08-05織夢dedecms什么時候用欄目交叉功能?
- 01-10使用C語言求解撲克牌的順子及n個骰子
- 01-10C#中split用法實例總結(jié)
- 04-02jquery與jsp,用jquery


