Select to view content in your preferred language

Query results into ADG and sorting

365
0
02-13-2014 03:23 AM
raffia
by
New Contributor II
Hello;

So am loading a bunch of points into an ADG and point on the map too. There are these little functions that do a relationship query based on a landmark type. All was working great, the issue was sorting the results alphabetically in the ADG. When you click on the top column of the ADG, it sorted them, but when you select an item from the ADG, the map would zoom to an incorrect point, far away from the intended location. This didn't happen if you didn't sort the results.

I added code to sort the results programatically with the same issue. The map zooms to the wrong point.

private function doQueryLandmarkAppliances(event:Event) : void{ landmarkTypeQueryTask = null;


    landmarkTypeQueryTask = new QueryTask;
    var landmarksRelationshipQuery:RelationshipQuery = new RelationshipQuery();            
    landmarksRelationshipQuery.objectIds = [120]; 
    landmarksRelationshipQuery.relationshipId = 3; 
    landmarksRelationshipQuery.outFields = ["*"]; 
    landmarksRelationshipQuery.returnGeometry = true; 
    landmarksRelationshipQuery.outSpatialReference = myMap.spatialReference;
    landmarkTypeQueryTask.method = URLRequestMethod.POST;
    landmarkTypeQueryTask.url = "http://arcgis4.roktech.net/arcgis/rest/services/DigitalEgypt/EGIPA_NewCairo/MapServer/25";
    landmarkTypeQueryTask.executeRelationshipQuery(landmarksRelationshipQuery, new AsyncResponder(onLandmarksAppliancesResult, onRelationshiptQueryFault, null));
}

private function onLandmarksAppliancesResult( result:Object, token:Object = null ) : void
{       
    landmarkResultsCount = result[120].features.length;
    launchLandmarksADG(); 
        landmarksADGVar.landmarksADG.dataProvider =  sortAttributes(result[120].attributes);
    for each (myLandmarksGraphic in result[120].features)
    {        
        selectedLandmarkObjectID = myLandmarksGraphic.attributes.OBJECTID;        


        myLandmarksGraphic.symbol = appliancesMMarker;
        landmarksGraphicsLayer.add(myLandmarksGraphic);    
            
    }    
}

private function sortAttributes(attrs:Array):Array
{
    return attrs.sortOn("LandmarkEName");
}

Tags (2)
0 Kudos
0 Replies