在单击填充我的数据网格时,我有一个“获取数据”按钮。我想同时用数据网格的列名填充组合框。在生成调用时,结果将存储在最后一个结果中,然后我将其存储到数组中。
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.events.ListEvent;
import mx.rpc.events.ResultEvent;
import services.ServiceManager;
import spark.events.IndexChangeEvent;
[Bindable] public var ArrColl_selectOptionComboBox:ArrayCollection = new ArrayCollection;
[Bindable] public var SelectOption:ArrayCollection = new ArrayCollection;
[Bindable] public var mainArrColl:ArrayCollection = new ArrayCollection;
[Bindable] public var DGDataProvider:ArrayCollection = new ArrayCollection;
[Bindable] public var DGDataProvider1:ArrayCollection = new ArrayCollection;
public function clear():void
{
DGDataProvider = new ArrayCollection;
}
//clicking on the Get Data button to retrieve from the Jiraissue
protected function button_clickHandler(event:MouseEvent):void
{
getAllJiraissueResult2.token=jiraissueService1.getAllJiraissue();
}
protected function getAllJiraissueResult2_resultHandler(event:ResultEvent):void
{
mainArrColl = getAllJiraissueResult2.lastResult as ArrayCollection;
DGDataProvider = mainArrColl;
}
//protected function Combobox_Option_changeHandler(event:ListEvent):void
//{
//myLabel.text = "You selected: " + ComboBox(event.target).selectedItem.label;
//Value.prompt="Select Value";
//Value.selectedIndex=-1; // reset so prompt shows
//}
]]>
</fx:Script>
<fx:Declarations>
<jiraissueservice1:JiraissueService1 id="jiraissueService1" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
<s:CallResponder id="getAllJiraissueResult2" result="getAllJiraissueResult2_resultHandler(event)"/>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Button x="59" y="49" label="GET DATA" id="button" click="button_clickHandler(event)"/>
<mx:DataGrid x="60" y="299" width="800" id="dataGrid" dataProvider="{DGDataProvider}">
<mx:columns>
<mx:DataGridColumn headerText="pkey" dataField="pkey"/>
<mx:DataGridColumn headerText="PROJECT" dataField="pname"/>
<mx:DataGridColumn headerText="CREATED" dataField="CREATED"/>
<mx:DataGridColumn headerText="defectType" dataField="stringvalue"/>
<mx:DataGridColumn headerText="Reporter" dataField="REPORTER"/>
<mx:DataGridColumn headerText="ASSIGNEE" dataField="ASSIGNEE"/>
<mx:DataGridColumn headerText="SLA" dataField="SLA"/>
</mx:columns>
</mx:DataGrid>
<s:Button x="214" y="49" label="RESET" click="clear()"/>
<s:Button x="557" y="168" label="Button"/>
<mx:ComboBox id="Combobox_Option" width="201" dataProvider="{SelectOption}" labelField="label"
prompt="Select Option"
x="59" y="169"/>
<mx:ComboBox id="Value" width="201" labelField="label"
prompt="Select Value" dataProvider="{DGDataProvider1}"
x="308" y="169"/>
<s:Label id="myLabel" text="You selected:" fontWeight="bold" x="59" y="275"/>