我有这个datagrid:
<mx:DataGrid id="dgCompetenteN" includeIn="Test" left="10" right="472" top="69" bottom="149"
dataProvider="{colCompetente}" editable="false">
<mx:columns>
<mx:DataGridColumn headerText="ID Competență" dataField="idCompetenta"/>
<mx:DataGridColumn headerText="Denumire Competență" dataField="denCompetenta"/>
<mx:DataGridColumn headerText="Competență Superioară" dataField="idCompSuperioara" rendererIsEditor="true" editorDataField="idCompSuperioara" itemRenderer="renderers.CompetentaSuperioara"/>
</mx:columns>
</mx:DataGrid>
以及此表格:
<s:Form includeIn="Test" x="536" y="69">
<s:FormItem label="Denumire competenta">
<s:helpContent>
<s:Label text="Help String"></s:Label>
</s:helpContent>
<s:TextInput text="{dgCompetenteN.selectedItem.denCompetenta}"/>
</s:FormItem>
<s:FormItem label="Competenta superioara">
<s:helpContent>
<s:Label text="Help String"></s:Label>
</s:helpContent>
<s:DropDownList dataProvider="{colCompetente}"
labelField="denCompetenta">
</s:DropDownList>
</s:FormItem>
</s:Form>
我想要做的是,当我在数据网格中选择一个项目时,下拉列表的选定项目应该是正确的(具有字段idCompSuperioara的字段等于所选数据网格行中的第三个元素)。
有什么想法吗?
谢谢。
答案 0 :(得分:1)
尝试以下几点:
项目单击处理程序:
protected function dgCompetenteN_itemClickHandler(event:ListEvent):void
{
for each (var o:Object in colCompetente)
{
if (o.idCompSuperioara == dgCompetenteN.selectedItem.idCompSuperioara)
{
ddlCompetenta.selectedItem = o;
break;
}
}
}
DataGrid:
<mx:DataGrid id="dgCompetenteN" includeIn="Test" left="10" right="472" top="69" bottom="149" dataProvider="{colCompetente}" editable="false" itemClick="dgCompetenteN_itemClickHandler(event)">
<mx:columns>
<mx:DataGridColumn headerText="ID Competență" dataField="idCompetenta"/>
<mx:DataGridColumn headerText="Denumire Competență" dataField="denCompetenta"/>
<mx:DataGridColumn headerText="Competență Superioară" dataField="idCompSuperioara" rendererIsEditor="true" editorDataField="idCompSuperioara" itemRenderer="renderers.CompetentaSuperioara"/>
</mx:columns>
</mx:DataGrid>
表格:
<s:Form includeIn="Test" x="536" y="69">
<s:FormItem label="Denumire competenta">
<s:helpContent>
<s:Label text="Help String"></s:Label>
</s:helpContent>
<s:TextInput text="{dgCompetenteN.selectedItem.denCompetenta}"/>
</s:FormItem>
<s:FormItem label="Competenta superioara">
<s:helpContent>
<s:Label text="Help String"></s:Label>
</s:helpContent>
<s:DropDownList id="ddlCompetenta" dataProvider="{colCompetente}"
labelField="denCompetenta">
</s:DropDownList>
</s:FormItem>
</s:Form>