I'm working on a geographic application using the ArcGIS JavaScript API 3.x. I am looking for a method that runs when a user clicks on suggestion Menu in the Search Bar for showing a specific feature InfoWindow.
Simply I am looking for a method to open an InfoWindow for a specific feature (for example method who I will pass the id of a feature to, and after execution the info window will be showed)
-
Which ArcGIS-JS-API Version are you using, 4.x or 3.x? I would like to understand better your workflow... You have to trigger an action when the user clicks on suggestion method, isn't it? and then you have to open the info window for a specific feature, sing the attribute (ID) that is inside the search box?Katah– Katah2018年08月01日 08:07:35 +00:00Commented Aug 1, 2018 at 8:07
-
Yes, exactly this is what I want, I use version 3, XMapp– Mapp2018年08月02日 20:37:25 +00:00Commented Aug 2, 2018 at 20:37
1 Answer 1
You can use the infoWindowBase.show(location)
method from the InfoWindowBase class. In that case you have to pass through a geometry of type point.
Here a code sample (I didn't test it):
function showInfoWindow(feature) {
map.graphics.clear();
//set symbol, if you want to perform a highlight
var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 2), new dojo.Color([255,255,0,0.5]));
feature.setSymbol(symbol);
map.graphics.add(feature);
//construct infowindow, for example set title and content
var title = "My Info";
var content = "Field ID : " + feature.attributes.FIELD_NUMBER;
map.infoWindow.setTitle(title);
map.infoWindow.setContent(content);
// Show the info window
map.infoWindow.show(feature.geometry);
}
-
I have a problem that I can't create a direction in the infoWindow so I have another idea of you can help me please, so I have created a featureLayer in contractor I have passed infoTemplate I want just show this info template without recreate a new infoWindow thank'sMapp– Mapp2018年08月06日 13:53:41 +00:00Commented Aug 6, 2018 at 13:53
Explore related questions
See similar questions with these tags.