我不知道该怎么做,现在尝试了几件事,所以我会问。下面显示了我想要的。我只是不知道如何让它工作。
我有一个有几个问题和相关答案的交流电。这些必须显示在 DG 中,其想法是 DG 的行和列绑定到 AC。例如,如果问题 1 的答案是“是”,则“是”按钮必须为真,而其他两个都必须为假(如在正常的单选按钮组行为中)。但是当我通过单击更改按钮时,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>