首页 > 代码库 > DataGridColumn中显示RadioButton
DataGridColumn中显示RadioButton
DataGridColumn中显示RadioButton
[1].[图片] 1.jpg
[2].[图片] 2.jpg
[3].[代码] [Flash/ActionScript/Flex]代码
[Bindable]
var temp:Array = new Array();
protected function application1_creationCompleteHandler(event:FlexEvent):void
{
var obj:Object = new Object();
obj.name = "张三";
obj.score = "60";
var obj2:Object = new Object();
obj2.name = "李四";
temp.push(obj);
temp.push(obj2);
qqq.dataProvider = temp;
}
<mx:VBox>
<mx:DataGrid id="qqq" editable="true" >
<mx:columns>
<mx:DataGridColumn headerText="名字" dataField="name" />
<mx:DataGridColumn id="item" headerText="分数" dataField="score" editorDataField="value" rendererIsEditor="true"
width="200">
<mx:itemRenderer>
<fx:Component>
<mx:HBox creationComplete="radioGroupHBox_creationCompleteHandler(event)" >
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
public function get value():Object {
return radioGroup.selectedValue;
}
override public function set data(value:Object):void {
super.data = value;
radioGroup.selectedValue = value.score;
}
public function resetRadioGroup(event:MouseEvent):void {
radioGroup.selection = null;
}
protected function radioGroupHBox_creationCompleteHandler(event:FlexEvent):void
{
outerDocument.resetBtn.addEventListener(MouseEvent.CLICK, resetRadioGroup);
}
]]>
</fx:Script>
<mx:RadioButtonGroup id="radioGroup" />
<mx:RadioButton label="优秀" value="http://www.mamicode.com/90" groupName="radioGroup" />
<mx:RadioButton label="良好" value="http://www.mamicode.com/80" groupName="radioGroup" />
<mx:RadioButton label="及格" value="http://www.mamicode.com/60" groupName="radioGroup" />
</mx:HBox>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
<mx:Button id="resetBtn" label="Reset" />
</mx:VBox>
[4].[代码] [Flash/ActionScript/Flex]代码<!--
<mx:DataGridColumn id="item" headerText="分数" dataField="score" editorDataField="value" rendererIsEditor="true">
radioGroup.selectedValue = value.score;
以上代码中以自己的field变化
-->
下载地址:http://www.huiyi8.com/java/actionscript/(转载请注明此处)
DataGridColumn中显示RadioButton
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。