Open the attribute inspector with objectid

1601
1
12-19-2016 11:14 PM
ozcandurak
New Contributor III

Hi,

I m using the Editor to display attribute inspector. But for some cases i need to open the display the attribute inspector with the object id i have.

Is it possible to make a query with object id, and display its data in the editor attribute inspector ?

Best Regards.

0 Kudos
1 Reply
TomSellsted
MVP Regular Contributor

Ozcan,

You should be able to do this pretty easily.  There is a good example here:

Using the attribute inspector | ArcGIS API for JavaScript 3.18 

You can easily add a function like this to select a feature by OBJECTID and open the info window containing the attribute inspector.  Here is a code snippet:

function updateByOBID(myOBID)
     var selectQuery = new Query();
     selectQuery.where = "OBJECTID = " + myOBID;
     selectQuery.returnGeometry = true;
     teamsFL.selectFeatures(selectQuery, FeatureLayer.SELECTION_NEW, function(features) {
          if (features.length > 0) {
               //store the current feature
               updateFeature = features[0];
               map.infoWindow.setTitle(features[0].getLayer().name);
               map.infoWindow.show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint));
          } else {
               map.infoWindow.hide();
          }
     });
}

regards,

Tom