Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I am providing you the sample code that i have created that uses ItemRenderer and ItemEditor both in a single DataGrid you just need to create a new mxml component that is name d ComNS and ComCB. Just create that i am givng you the sample code.</p> <p>Code for main mxml Appication</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" horizontalAlign="center" verticalAlign="middle" height="100%" width="100%"&gt; &lt;mx:Script&gt; &lt;![CDATA[ public var arr:Array = new Array({isSelected:true,label:'ABC',score:'78',name:'ABC'}, {isSelected:true,label:'DEF',score:'50',name:'DEF'}, {isSelected:false,label:'GHI',score:'70',name:'GHI'}, {isSelected:false,label:'JKL',score:'80',name:'JKL'}, {isSelected:true,label:'TRE',score:'50',name:'MNO'}); public function dgCLG_dataChange():void { } public function dgCLG_change():void { } public function btnSubmit_click():void { dgCopy.dataProvider = dgCLG.dataProvider; } ]]&gt; &lt;/mx:Script&gt; &lt;mx:VBox height="100%" width="100%" horizontalAlign="center" verticalAlign="middle"&gt; &lt;mx:DataGrid id="dgCLG" dataProvider="{arr}" editable="true" dataChange="{dgCLG_dataChange();}" change="{dgCLG_change();}"&gt; &lt;mx:columns&gt; &lt;mx:DataGridColumn headerText="" dataField="isSelected"&gt; &lt;mx:itemRenderer&gt; &lt;mx:Component&gt; &lt;mx:Box horizontalAlign="center" verticalAlign="middle" height="100%" width="100%"&gt; &lt;mx:Script&gt; &lt;![CDATA[ override public function set data(value:Object):void { if(value != null) { super.data = value; var temp:Object = value as Object; chb.selected = temp.isSelected; } } ]]&gt; &lt;/mx:Script&gt; &lt;mx:CheckBox id="chb"/&gt; &lt;/mx:Box&gt; &lt;/mx:Component&gt; &lt;/mx:itemRenderer&gt; &lt;/mx:DataGridColumn&gt; &lt;mx:DataGridColumn headerText="Label" dataField="label" editable="false"&gt; &lt;/mx:DataGridColumn&gt; &lt;mx:DataGridColumn headerText="Marks" dataField="score" editable="true" itemEditor="ComNS" editorDataField="value"&gt; &lt;/mx:DataGridColumn&gt; &lt;mx:DataGridColumn dataField="name" headerText="Person" itemEditor="ComCB" editorDataField="value" editable="true"&gt; &lt;/mx:DataGridColumn&gt; &lt;/mx:columns&gt; &lt;/mx:DataGrid&gt; &lt;mx:Button id="btnSubmit" label="Click" click="{btnSubmit_click();}" /&gt; &lt;mx:DataGrid id="dgCopy" editable="false"&gt; &lt;mx:columns&gt; &lt;mx:DataGridColumn headerText="CopyLabel" dataField="label" /&gt; &lt;mx:DataGridColumn headerText="CopyMarks" dataField="score" /&gt; &lt;mx:DataGridColumn headerText="CopyPerson" dataField="name" /&gt; &lt;/mx:columns&gt; &lt;/mx:DataGrid&gt; &lt;/mx:VBox&gt; &lt;/mx:Application&gt; </code></pre> <p>Code for ComNS.mxml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;mx:NumericStepper xmlns:mx="http://www.adobe.com/2006/mxml" minimum="0" maximum="100"&gt; &lt;/mx:NumericStepper&gt; </code></pre> <p>Code for ComCB.mxml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml" dataProvider="{arr}" selectedIndex="1" creationComplete="{c_complete();}" &gt; &lt;mx:Script&gt; &lt;![CDATA[ public var arr:Array = new Array({label:'ABC'},{label:'DEF'},{label:'GHI'},{label:'JKL'},{label:'MNO'}) public function c_complete():void { for(var i:int = 0; i &lt; arr.length; i++) { if(arr[i].label == parentDocument.dgCLG.selectedItem.name) { this.selectedItem = arr[i]; } } } ]]&gt; &lt;/mx:Script&gt; &lt;/mx:ComboBox&gt; </code></pre> <p>If any query just comment on my answer....</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload