在datagrid的itemrenderer下使用radiobutton中使用radiobutton组时,我收到以下错误,

时间:2013-11-05 06:06:45

标签: flex datagrid adobe flex4.5

在datagrid的itemrenderer下使用radiobutton中使用radiobutton组时,我收到以下错误,

错误#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>

1 个答案:

答案 0 :(得分:0)

尝试将fx:声明与fx:Component中的radiobutton组放在一起。 radioButtonGrp超出范围。 它看起来像你使用flex 4.x.你可以尽可能坚持使用火花元件。