简体   繁体   中英

flex datagrid checkbox renderer

im my flex application i have a datgrid as follows

<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> 

by default editable = false;

now if i select a checkbox the corressponding row alone should become editable how its possible?? give me some suggestions..thankxx in advance!!

try this

   <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>

I hope this might help you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM