【问题标题】:flex datagrid checkbox rendererflex 数据网格复选框渲染器
【发布时间】:2011-12-22 08:39:52
【问题描述】:

我的弹性应用程序我有一个 datgrid 如下

<mx:DataGrid id="grid" > 
<mx:columns> 
    <mx:DataGridColumn headerText="Select"  dataField="itemSelInd" editable="false" textAlign="center"   >
                                <mx:itemRenderer >
                                    <mx:Component>
                                    <mx:CheckBox> 
                                </mx:CheckBox>
                                    </mx:Component>
                                </mx:itemRenderer>
                            </mx:DataGridColumn>
    <mx:DataGridColumn dataField="name" headerText="Name"/> 
    <mx:DataGridColumn dataField="date" headerText="Date"/>
    <mx:DataGridColumn dataField="month" headerText="Month"/>
    <mx:DataGridColumn dataField="year" headerText="Year"/>


 </mx:columns> </mx:DataGrid> 

默认可编辑 = false;

现在,如果我选择一个复选框,则相应的行单独应该变得可编辑,它怎么可能? 给我一些建议..thankxx提前!!

【问题讨论】:

    标签: apache-flex actionscript datagrid flex3


    【解决方案1】:

    试试这个

       <mx:ArrayCollection id="sad">
    <mx:source>
        <mx:Object itemSelInd="true" named="sudharsanan" date="0" month="4" year="1989"/>
        <mx:Object itemSelInd="false" named="sudharsanan" date="1" month="4" year="1989"/>
        <mx:Object itemSelInd="true" named="sudharsanan" date="0" month="4" year="1989"/>
    </mx:source>
    </mx:ArrayCollection>
        <mx:DataGrid id="asad" editable="true" dataProvider="{sad}">
            <mx:columns>
                <mx:DataGridColumn headerText="Select"  dataField="itemSelInd" editable="false" textAlign="center"   >
                                            <mx:itemRenderer >
                                                <mx:Component>
                                                    <mx:CheckBox click="{data.itemSelInd = !data.itemSelInd}"/>
                                                </mx:Component>
                                            </mx:itemRenderer>
                                        </mx:DataGridColumn>
                <mx:DataGridColumn dataField="named" headerText="Name" >
                    <mx:itemEditor>
                            <mx:Component>
                                <mx:TextInput editable="{data.itemSelInd}" text="{data.named}"/>
                            </mx:Component>
                        </mx:itemEditor>
                </mx:DataGridColumn> 
                <mx:DataGridColumn dataField="date" headerText="Date" >
                    <mx:itemEditor>
                        <mx:Component>
                            <mx:TextInput editable="{data.itemSelInd}" text="{data.date}"/>
                        </mx:Component>
                    </mx:itemEditor>
                </mx:DataGridColumn>
    
            </mx:columns>
        </mx:DataGrid>
    

    希望对你有帮助

    【讨论】:

    • 这仅在属性data.itemSelInd 是可绑定的情况下才有效。
    • 能否有人(无论是 Loremlpsum 还是其他人)详细说明 Loremlpsum 所说的内容吗?这可能与我遇到的问题有关。谢谢!
    • 基本上在我自己的数据网格中使用相同的方法,我看到检查的复选框发生错误变化的问题,至少在元素数量足够大的情况下(例如,大约是大小的两倍这将适合网格的可见范围本身)。当用户滚动时,错误的修改往往会发生更多。这听起来像是一个熟悉的错误吗?
    猜你喜欢
    • 1970-01-01
    • 2014-07-30
    • 2011-03-10
    • 2012-01-21
    • 2015-07-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多