【问题标题】:Checkbox itemrenderer displaying the wrong selected value in datagrid复选框 itemrenderer 在数据网格中显示错误的选定值
【发布时间】:2011-12-05 07:33:10
【问题描述】:

我的数据网格中有一个复选框作为 itemRenderer。我正在从我的数据库表的列中设置选定的值。变量的值为“true”,但我的复选框被选中,尽管我将其 selected 属性设置为 true 的数据字段。

我的代码如下:

<mx:DataGrid id="myGD" fontSize="9" enabled="true" x="20" y="20" width="217" height="60">
    <mx:columns>
        <mx:DataGridColumn rendererIsEditor="true" editorDataField="selected" width="20" headerText="isDefault" dataField="IS_DEFAULT">
            <mx:itemRenderer>
                <fx:Component>
                    <mx:HBox horizontalAlign="left">
                        <s:CheckBox selected="{Boolean(data['IS_DEFAULT'])}" horizontalCenter="0"/>
                    </mx:HBox>
                </fx:Component>
            </mx:itemRenderer>
        </mx:DataGridColumn>
    </mx:columns>
</mx:DataGrid>

有人可以帮助我了解这里出了什么问题吗? 非常感谢

【问题讨论】:

    标签: datagrid checkbox flash-builder itemrenderer


    【解决方案1】:

    项目渲染器应如下所示。 实际上,我的真假值是作为字符串发送的。 因此,两者都被评估为真。

    <mx:itemRenderer>
        <fx:Component>
           <mx:HBox horizontalAlign="left">
               <s:CheckBox selected="{data.MY_FIELD == 'false' ? false : true}" horizontalCenter="0"/>
           </mx:HBox>
        </fx:Component>
    </mx:itemRenderer>
    

    【讨论】:

      猜你喜欢
      • 2012-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-17
      • 2020-12-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多