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)

  • 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 Aug 1 '18 at 8:07
  • Yes, exactly this is what I want, I use version 3, X – Mapp Aug 2 '18 at 20:37
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);
  }
  • 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 – Mapp Aug 6 '18 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.