Select to view content in your preferred language

Including an option in ComboBox to return ALL

571
0
05-16-2011 01:13 PM
RobertMyers
Deactivated User
Is it possible to add to the Array Collection, in the below code, an option to return ALL? And also to set the starting select item to ALL?

Thanks.



<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      minWidth="1024" minHeight="768"
      xmlns:esri="http://www.esri.com/2008/ags" xmlns:mx="library://ns.adobe.com/flex/mx"
      >
<fx:Declarations>
  <esri:QueryTask id="queryTask"
      showBusyCursor="true"
      url="http://trainingcloud.arcgis.com/ArcGIS/rest/services/Redlands_PointsOfInterest/MapServer/0" />
 
  <esri:Query id="query"
     where="TYPE='{typesChoose.selectedItem}'"
     returnGeometry="true" outSpatialReference="{mainMap.spatialReference}"
    
     >
   <esri:outFields>
    <fx:String>NAME</fx:String>
    <fx:String>Match_addr</fx:String>
   </esri:outFields>
  </esri:Query>
 
</fx:Declarations>

<esri:Map id="mainMap">
 
  <esri:extent>
   <esri:Extent xmax="-13036105.863" ymax="4039974.029" xmin="-13052062.093" ymin="4032196.561">
    <esri:SpatialReference wkid="102100"/>
   </esri:Extent>
  </esri:extent>
 
  <esri:ArcGISTiledMapServiceLayer url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
 
  <esri:GraphicsLayer id="myGraphicsLayer" graphicProvider="{queryTask.executeLastResult.features}">
   <esri:renderer>
    <esri:SimpleRenderer>
     <esri:SimpleMarkerSymbol id="basicSymbol" color="0xff0000" style="diamond" />       
    </esri:SimpleRenderer>
   </esri:renderer>
  </esri:GraphicsLayer>
 
</esri:Map>

<s:Panel top="50" right="50" id="leftPanel" width="350" height="400">
  <s:layout>
   <s:VerticalLayout
    horizontalAlign="left"
    paddingLeft="10"
    paddingRight="10"
    paddingTop="10"
    paddingBottom="10" />
  </s:layout>
 
  <s:ComboBox id="typesChoose" selectedItem=" " change="queryTask.execute(query)"
     width="75%">
   <s:ArrayCollection>
    <fx:String>Shopping</fx:String>
    <fx:String>Restaurant</fx:String>
    <fx:String>Apartment</fx:String>
    <fx:String>Arts</fx:String>
    <fx:String>Bank</fx:String>
    <fx:String>Historic</fx:String>
    <fx:String>Recreation</fx:String>
   </s:ArrayCollection>   
  </s:ComboBox>
 
  <mx:DataGrid id="resultsGrid" width="100%" height="100%"
      dataProvider="{queryTask.executeLastResult.attributes}">
   <mx:columns>
    <mx:DataGridColumn headerText="Name" dataField="NAME"/>
    <mx:DataGridColumn headerText="Address" dataField="Match_addr"/>
   </mx:columns>
  </mx:DataGrid>
 
</s:Panel>

</s:Application>
Tags (2)
0 Kudos
0 Replies