I try to implement 'select graphics within extent' tool in my project.
I commented out the lines that I think it doesn't need but nothing happen. When I uncommented it, it only return value from one column.
What I need to do is to create a button for select graphic within extent and return results in my master datagrid.
Please help!
p.s. please see attachment for the entire code. //Select EOC member by Polygon Extent, click event function
private function drawExtent():void { //var queryTask:QueryTask = new QueryTask("http://gisserver/ArcGIS/rest/services/EOC/MapServer/0"); //var query:Query = new Query(); //query.where = "EmpNo > 0"; //query.returnGeometry = true; //query.outFields = ["EmpNo", "Fname", "Lname", "ADDRESS_LINE_1", "City", "Team", "PositionTitle", "Title", "DeptName", "HMPhone", "GIS_MILE"]; queryTask.execute(queryselect, new AsyncResponder(onResult, onFault));
function onResult(featureSet:FeatureSet, token:Object = null):void { for each (var myGraphic:Graphic in featureSet.features) { myGraphic.symbol = defaultSymbol; myGraphicsLayer.add(myGraphic); } } function onFault(info:Object, token:Object = null):void { Alert.show(info.toString()); }
drawToolbar.activate(Draw.EXTENT); }
private function drawEndHandler(event:DrawEvent):void {
var extent:Extent = event.graphic.geometry as Extent; var graphic:Graphic; var results:ArrayCollection = new ArrayCollection; for (var i:Number = 0 ; i < myGraphicsLayer.numChildren ; i++) { graphic = myGraphicsLayer.getChildAt(i) as Graphic; //if point is contained within extent, highlight it and add for display in results list if (extent.contains(MapPoint(graphic.geometry))) { graphic.symbol = highlightedSymbol; results.addItem(graphic.attributes.Fname); } //else if point was previously highlighted, reset its symbology else if (graphic.symbol == highlightedSymbol) { graphic.symbol = defaultSymbol; } } labelPoints.text = "# of points in extent = " + results.length; //dg.visible = true; //dg.dataProvider = results; pnlDataGrid.visible = true; resultsGrid.visible = true; resultsGrid.dataProvider = results; }