0

在数据网格的 itemrenderer 下使用的单选按钮中使用单选按钮组时,出现以下错误,

错误 #2025:提供的 DisplayObject 必须是调用者的子对象。

请只做那些需要的。

<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:services="services.*"
xmlns:valueObjects="valueObjects.*"
xmlns:components="paging.*"
xmlns:rfiComp="rfi.*"
xmlns:communicationComp="Communication.*"
xmlns:jobOpeningComp="JobOpening.*"
xmlns:net="flash.net.*"
xmlns="*"
width="1030" height="634" creationComplete="init()" >

<fx:Declarations>
<mx:RadioButtonGroup id="radioButtonGrp"/>              
<fx:Declarations>


<s:BorderContainer visible="true" id="userSummaryContainer" width="988" height="466" borderWeight="2" >

<s:Button x="10" y="10"  label="New User" height="22" click="newUser_clickHandler(event)" />


<mx:DataGrid id="UserSummaryGrid" x="10" y="72" width="964" height="355"
creationComplete="UserSummaryGrid_creationCompleteHandler(event)"
dataProvider="{getUserSummaryListResult.lastResult}"
horizontalScrollPolicy="on"
 chromeColor="#D0E2F6" variableRowHeight="true" >

<mx:columns>
<mx:DataGridColumn  headerText="#" textAlign="center" width="25" wordWrap="true" headerWordWrap="true" >
  <mx:itemRenderer>
                  <fx:Component>
                                   <mx:Box width="100%" height="100%"
                                                                  horizontalAlign="center" verticalAlign="top" >
                                                   <mx:RadioButton id="rb" group="{radioButtonGrp}" value="{data.userId}" click="outerDocument.userSelected(data.userId)"
                                                                                                                   selected="{data.userId == null ? true:false}"/>
                                   </mx:Box>
                  </fx:Component>
  </mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn textAlign="left" wordWrap="true" width="100" dataField="employeeId" headerText="Employee ID"/>
<mx:DataGridColumn textAlign="left" wordWrap="true" width="130" dataField="roleDescription" headerText="Role"/>
</mx:columns>
</mx:DataGrid>


</s:WindowedApplication>
4

1 回答 1

0

尝试将您的 fx:Declaration 与 fx:Component 中的单选按钮组一起放置。radioButtonGrp 超出范围。此外,您似乎正在使用 flex 4.x。您不妨尽可能坚持使用火花组件。

于 2013-11-05T15:44:08.427 回答