When my app changes context (user clicks on a tab) I want to programmatically "Select" the first of 6 points in my Feature Layer so I get the blue box around the point and activate the info window.
I looked around the API Docs and found the FeatureLayer's selectFeatures method. This method takes a Query object, and a selection method (I'm creating a new selection so I'll use SELECTION_NEW). The function returns a promise, but do I really need any kind of callback? I'm just trying to select a feature.
Here is the definition of my feature layer:
var projectsAGOL = new esri.layers.FeatureLayer("http://services.arcgis.com/QVENGdaPbd4LUkLV/arcgis/rest/services/rioLocoSites/FeatureServer/0",{
infoTemplate: infoTemplate,
visible: true,
outFields: ["*"]
});
Click handler for the Tab:
jQuery("#prjMap").click(function(){
var query = new esri.tasks.Query(); // Create a Query Object
query.where = "OBJECTID = 0"; // Select the first point from the Feature Layer
projectsAGOL.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW); // Apply selection
});
This code does not produce the desired outcome nor does it produce an error. Nothing happens. Am I even using the correct method to make a selection? I'm more familiar with the Leafletjs mapping library.
Update: Provided jsFiddle