0

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)

Katah
1,0707 silver badges12 bronze badges
asked Jul 30, 2018 at 9:41
2
  • 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? Commented Aug 1, 2018 at 8:07
  • Yes, exactly this is what I want, I use version 3, X Commented Aug 2, 2018 at 20:37

1 Answer 1

0

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);
 }
answered Aug 3, 2018 at 7:19
1
  • 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's Commented Aug 6, 2018 at 13:53

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.