我認爲這將要對你有幫助...
<?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