选择数据网格项目时,在详细信息表单下拉列表中选择项目

tjvv9vkg  于 2022-09-21  发布在  Apache
关注(0)|答案(1)|浏览(193)

我有这个数据网格:

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

我想要做的是,当我在数据网格中选择一项时,下拉列表中选择的项应该是正确的项(字段idCompSuperiara等于所选数据网格行中的第三个元素的项)。

有什么主意吗?

谢谢。

ndasle7k

ndasle7k1#

试着做一些这样的事情:

itemClickHandler:

protected function dgCompetenteN_itemClickHandler(event:ListEvent):void
{
  for each (var o:Object in colCompetente)
  {
    if (o.idCompSuperioara == dgCompetenteN.selectedItem.idCompSuperioara)
    {
      ddlCompetenta.selectedItem = o;
      break;
    }
  }
}

数据网格:

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

相关问题