これを行う方法がわかりません。いくつかのことを今試したので、私は尋ねます。以下は、私が望むものを示しています。私はちょうどそれを働かせる方法を知っていません。RadioButtonGroupを持つDatagrid itemrenderer
私にはいくつかの質問と同義の回答があるACがあります。これらはDGに表示する必要があり、DGの行と列がACにバインドされているという考えがあります。たとえば、質問1の答えがYesの場合、Yesボタンはtrueでなければならず、他のボタンは両方ともfalseでなければなりません(通常のradiobuttongroupの動作のように)。しかし、ボタンをクリックしてボタンを変更すると、それに応じてACのアクションデータフィールドが変更されます。私はここで十分にクリアされていますか?
動的アンケートのためのものです。どんな助けも高く評価されます。
<?xml version = "1.0"?>
<mx:Application xmlns:mx = "http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
public var questions : ArrayCollection = new ArrayCollection([
{ question: 'Question 1', anwer: 'Yes' },
{ question: 'Question 2', anwer: 'No' },
{ question: 'Question 3', anwer: 'Unknown' }, ]);
]]>
</mx:Script>
<mx:Panel title = "Questionaire example" height = "100%" width = "100%" paddingTop = "10"
paddingLeft = "10" paddingRight = "10">
<mx:DataGrid id = "dg" width = "100%" height = "100%" dataProvider = "{questions}">
<mx:columns>
<mx:DataGridColumn dataField = "question" headerText = "Questions"/>
<mx:DataGridColumn width = "80" textAlign = "center" editable = "false"
headerText = "Yes">
<mx:itemRenderer>
<mx:Component>
<mx:HBox horizontalAlign = "center" verticalAlign = "middle">
<mx:RadioButton/>
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn width = "80" textAlign = "center" editable = "false"
headerText = "No">
<mx:itemRenderer>
<mx:Component>
<mx:HBox horizontalAlign = "center" verticalAlign = "middle">
<mx:RadioButton/>
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn width = "80" textAlign = "center" editable = "false"
headerText = "Unknown">
<mx:itemRenderer>
<mx:Component>
<mx:HBox horizontalAlign = "center" verticalAlign = "middle">
<mx:RadioButton/>
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
</mx:Panel>
</mx:Application>