2012-05-16 33 views
1

有人可以帮助您在Flex MX数据网格中循环显示单选按钮项目渲染器吗?如何在Flex中的数据网格中循环显示单选按钮项目渲染器

我的数据网格的代码如下:

<mx:DataGridColumn width="20" headerText="isDefault" dataField="IS_DEFAULT"> 
          <mx:itemRenderer> 
           <fx:Component> 
            <mx:HBox horizontalAlign="left"> 
             <fx:Script> 
              <![CDATA[ 
               import mx.controls.Alert; 
               import mx.controls.listClasses.ListData; 


               protected function chk1_changeHandler(event:Event):void 
               { 

               } 

              ]]> 
             </fx:Script> 
             <mx:RadioButton id="chk1" selected="{data.IS_DEFAULT == 'N' ? false : true}" 
                 groupName="{outerDocument.rbg11}" change="chk1_changeHandler(event)" horizontalCenter="0"/> 
              </mx:HBox> 
           </fx:Component> 
          </mx:itemRenderer> 
         </mx:DataGridColumn> 



Thanks for helping. 

回答

0

为什么不绑定复选框项内嵌的渲染与数据网格的数据提供程序的状态?是否还有其他一些功能可以通过每个复选框控件专门尝试访问?如果没有,我建议只增加了选择的/未被选择的属性来无论你的数据提供程序是并绑定该以“选择”属性为直列复选框渲染器是这样的:

<mx:RadioButton id="chk1" selected="{data.selected_property}" 
            groupName="{outerDocument.rbg11}" change="chk1_changeHandler(event)" horizontalCenter="0"/> 

,如果你想这样循环访问datagrid控件中每个复选框的“状态”,您可以在数据提供者级别执行此操作。您chk1_changeHandler()将只需拨动选定/不被选择的值:

protected function chk1_changeHandler(event:Event):void{ 
    if(data.selected_property == true){ 
     data.selected_property = false; 
    }else{ 
     data.selected_property = true; 
    } 
} 

我读了一些微妙的Flex 3的结合细微差别,在这里,如果你对MX死心塌地(〜3.X),而比4.6:About Binding

相关问题