Select to view content in your preferred language

Editnig without Editor , Show info Window in drawEnd

462
3
10-07-2010 04:31 AM
ZahyHwary
New Contributor
Hi Every body

I am using darwTool , editTool , and templateinpector to build my Editor Component as my buisness needs , but I am facing a problem , I need to open the InfowWindow and when I draw a new Feature , just like Editor component does ,I.e. the attributeInspector should appear in infoWindow when draw a new feature , so user shouldn't click the newly created feature to has this done ,

I am using a query object and give it the geometry from EndDrawEvent , and then use this query object in my  feature layer as the following :

protected function draw_drawEndHandler(event:DrawEvent):void
  {
                     for each (var layer:Layer in myMap.layers)
   {
    if (layer is FeatureLayer)
    {
     var l:FeatureLayer = layer as FeatureLayer
     queryMapClick.geometry = event.graphic.geometry;
      l.selectFeatures(queryMapClick, FeatureLayer.SELECTION_NEW);
     
    }
   }
             } 


the problem exactly in query object it throws Fault:4000 unable to perform Query .

Please help , thanks
Tags (2)
0 Kudos
3 Replies
JasonPatterson
Esri Contributor
I suggest opening an incident ticket with Support Services, they should be able to assist.
0 Kudos
SarthakDatt
Occasional Contributor III
Hey Zahy,

The attributeInspector works with the selected feature(s) on a feature layer. In your case you can select the newly created feature based on its object(unique) id.

e.g:

 protected function draw_drawEndHandler(event:DrawEvent):void
 {
     var featureLayer:FeatureLayer = templatePicker.selectedTemplate.featureLayer; // current featureLayer
     featureLayer.addEventListener(FeatureLayerEvent.EDITS_COMPLETE,featureLayer_editsCompleteHandler); // listening for edits complete

     featureLayer.applyEdits([ event.graphic ], null, null);     // saving the newly created feature
 }

private function featureLayer_editsCompleteHandler(event:FeatureLayerEvent):void
{
      var addResult:FeatureEditResult = event.featureEditResults.addResults[0];
      if (addResult.success === true)
      {   
            var query:Query = new Query();
            query.objectIds = [ addResult.objectId ];
            event.featureLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW);  // selecting the newly created feature
      }
}


AttributeInspector.activeFeature property would be updated with selection complete. You could now show the infoWindow with the attributeInspector for the newly created feature.

Hope that helps.
0 Kudos
ZahyHwary
New Contributor
Hi Sarthak

thanks for help , this works fine with me 🙂
0 Kudos