private function fillComboBoxWithData(cmb:ComboBox, displayFieldName:String, featureSet:FeatureSet):void { var results:ArrayCollection = new ArrayCollection(); for each (var graphic:Graphic in featureSet.features) { var fieldValue:String = graphic.attributes[displayFieldName].toString(); results.addItem({label: fieldValue, data:graphic}); } cmb.labelField = "label"; cmb.dataProvider = results; }
I'm creating a new widget with a series of combo boxes. The data source for each como box is a table that is part of a map service. Is it necessary to loop through the table and add the values to the combobox? Or can I just somehow reference the table using the QueryTask. Below is a snippet of my code showing what I'm trying to do. Any help or samples would be greatly appreciated!Thanks, Barb Patteron<fx: Declarations> <esri:QueryTask id="queryApps" url="http://arcportal-gamma/ArcGIS/rest/services/MyMapService/MapServer/1" useAMF="false"/> <esri:Query id="query" outFields="[AppScenario]" returnGeometry="false" /> </fx: Declarations>Inside my widget template I have:<mx:VBox> <mx:Label text="App Scenario"/> <mx:ComboBox id="App" labelField="" dataProvider="{queryApps.execute(query)}"/> </mx:VBox>
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.