我认为这将要对你有帮助...
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" horizontalAlign="center"
verticalAlign="middle" height="100%" width="100%">
<mx:Script>
<![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;
}
]]>
</mx:Script>
<mx:VBox height="100%" width="100%" horizontalAlign="center" verticalAlign="middle">
<mx:DataGrid id="dgCLG" dataProvider="{arr}" editable="true" dataChange="{dgCLG_dataChange();}" change="{dgCLG_change();}">
<mx:columns>
<mx:DataGridColumn headerText="" dataField="isSelected">
<mx:itemRenderer>
<mx:Component>
<mx:Box horizontalAlign="center" verticalAlign="middle" height="100%" width="100%">
<mx:Script>
<![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;
}
}
]]>
</mx:Script>
<mx:CheckBox id="chb"/>
</mx:Box>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="Label" dataField="label" editable="false">
</mx:DataGridColumn>
<mx:DataGridColumn dataField="name" headerText="Person" itemEditor="ComCB" editorDataField="value" editable="true">
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
<mx:Button id="btnSubmit" label="Click" click="{btnSubmit_click();}" />
<mx:DataGrid id="dgCopy" editable="false">
<mx:columns>
<mx:DataGridColumn headerText="CopyLabel" dataField="label" />
<mx:DataGridColumn headerText="CopyMarks" dataField="score" />
<mx:DataGridColumn headerText="CopyPerson" dataField="name" />
</mx:columns>
</mx:DataGrid>
</mx:VBox>
</mx:Application>
这里是ComCb组件。
<?xml version="1.0" encoding="utf-8"?>
<mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml" dataProvider="{arr}" selectedIndex="1" creationComplete="{c_complete();}" >
<mx:Script>
<![CDATA[
public var arr:Array = new Array({label:'ABC'},{label:'DEF'},{label:'GHI'},{label:'JKL'},{label:'MNO'},{label:'XXX'})
public function c_complete():void
{
for(var i:int = 0; i < arr.length; i++)
{
if(arr[i].label == parentDocument.dgCLG.selectedItem.name)
{
this.selectedItem = arr[i];
}
}
}
]]>
</mx:Script>
</mx:ComboBox>
可能是这该怎么对你有帮助...
有一个很好的d @Ÿ.......
我不完全理解发生了什么,也不知道你想要发生什么。尽管如此,我认为这个问题的视频屏幕截图会有很大的帮助。 – JeffryHouser 2011-12-20 15:00:18
我不能把截图,但我试图再解释一遍。 – TrexTroy 2011-12-20 15:08:00
这解释得好多了。我认为你将不得不深入代码并扩展它;因为似乎没有解决这类问题的财产。 – JeffryHouser 2011-12-20 15:48:20