Query result in table


<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:esri="http://www.esri.com/2008/ags"
xmlns:s="library://ns.adobe.com/flex/spark"
pageTitle="Query Task (without a map)">
<!--
This sample shows how to query the server and displaying
the result in a datagrid.
The query is sent using the execute() method on a QueryTask.

This sample sets up a QueryTask (what layer on what server to query).
When the user clicks the "Get Details" button, a Query is sent with
the user-provided text to search for.
Meanwhile a DataGrid has been created which listens for the results
(using executeLastResult) from the querytask.
-->

<s:layout>
<s:VerticalLayout horizontalAlign="center" paddingTop="25"/>
</s:layout>

<fx:Declarations>
<esri:QueryTask id="queryTask"
url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5"
useAMF="false"/>
<esri:Query id="query"
outFields="[STATE_NAME,STATE_FIPS,SUB_REGION,STATE_ABBR,POP2000,POP2007]"
returnGeometry="false"
text="{stateName.text}"/>
</fx:Declarations>

<s:Panel title="Using Query tasks without maps">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<s:HGroup verticalAlign="middle">
<s:Label text="US state name: "/>
<s:TextInput id="stateName" text="Carolina"/>
<s:Button click="queryTask.execute(query);" label="Get Details"/>
</s:HGroup>
<mx:DataGrid id="resultsGrid"
dataProvider="{queryTask.executeLastResult.attributes}"
visible="{queryTask.executeLastResult != null}">
<mx:columns>
<mx:DataGridColumn dataField="STATE_NAME" headerText="State Name"/>
<mx:DataGridColumn dataField="SUB_REGION" headerText="Region"/>
<mx:DataGridColumn dataField="STATE_FIPS" headerText="FIPS"/>
<mx:DataGridColumn dataField="STATE_ABBR" headerText="Abbreviation"/>
<mx:DataGridColumn dataField="POP2000" headerText="Population 2000"/>
<mx:DataGridColumn dataField="POP2007" headerText="Population 2007"/>
</mx:columns>
</mx:DataGrid>
</s:Panel>
</s:Application>

[b]注:[/b]Query里面的属性text真正的查询条件是,featuryLayer里的Display field = '%text%'
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值