1

在我的 flex 应用程序中,我使用带有以下列的数据网格

<mx:DataGrid x="10" y="265" width="1205" dataProvider="{vendors}"  editable="true" lockedColumnCount="4"   horizontalScrollPolicy="on">
                        <mx:DataGridColumn headerText="Select" editable="false" textAlign="center" >
                        <mx:itemRenderer >
                            <mx:Component>

                                <mx:CheckBox click="data.select = !data.select"  change="outerDocument.addDetail(data)"  selected="{data.select}" > 
                                </mx:CheckBox>
                            </mx:Component>
                        </mx:itemRenderer>
                    </mx:DataGridColumn>

                    <mx:DataGridColumn headerText="One" dataField="one" color="black" editable="false" width="125" />
                    <mx:DataGridColumn headerText="Two" dataField="two" color="black" editable="false" width="125"/>
                    <mx:DataGridColumn headerText="Three" dataField="three" color="black" editable="false"/>
                    </mx:DataGird>

现在我想禁用获取数据时的复选框列。如果用户选择数据网格中的任何字段进行编辑,则在数据网格中填充数据后。应该启用所选行的复选框...应该禁用其他行复选框..

我希望这些信息足以满足此要求

有什么想法吗?提前谢谢...

4

1 回答 1

0

我完全理解你的问题,但试图回答它。

<mx:DataGrid x="10" y="265" width="1205" dataProvider="{vendors}"  editable="true" lockedColumnCount="4"   horizontalScrollPolicy="on" id="dgGrid">
                    <mx:DataGridColumn headerText="Select" editable="false" textAlign="center" >
                    <mx:itemRenderer >
                        <mx:Component>

                            <mx:CheckBox click="data.select = !data.select"  change="outerDocument.addDetail(data)"  selected="{data.select}"
enabled="{outerDocument.dgGrid.selectedIndex==outerDocument.vendors.getItemIndex(data)}> 
                            </mx:CheckBox>
                        </mx:Component>
                    </mx:itemRenderer>
                </mx:DataGridColumn>

                <mx:DataGridColumn headerText="One" dataField="one" color="black" editable="false" width="125" />
                <mx:DataGridColumn headerText="Two" dataField="two" color="black" editable="false" width="125"/>
                <mx:DataGridColumn headerText="Three" dataField="three" color="black" editable="false"/>
                </mx:DataGird>

如果您的网格数据提供者是一个声明为公共的arrayCollection,这将起作用。

于 2011-12-02T10:00:47.423 回答