jjmiller1980

Different sized infoWindows

Discussion created by jjmiller1980 on Mar 23, 2012
I have a map that will plot 2 points on the map, and connect them using a line.  What I???m trying to accomplish is have one infoWindow when you click on the points, and a different one when you click on the lines connecting the points.  I have no problem getting the content I want, but I need the windows to use 2 different sizes. 

I have a 2 methods that create the content for the appropriate infoWindows.  In those methods, the first line is:

map.infoWindow.resize(325, 75);
or
map.infoWindow.resize(250, 210);

What happens is I view my map, click the line, and I get the smaller infoWindow.  Then I click the point and get the larger infoWindow.  From that point on, no matter what I click, I always get the large infoWindow. 

Here???s a couple examples of how I???m creating those infoWindows:

function mapPoints(results){
    var symbol = new esri.symbol.SimpleMarkerSymbol().setStyle(
        esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE).setSize(8).setColor(
        new dojo.Color( [ 255, 255, 255 ]));

    graphicsExtent = [];

    var infoTemplate = new esri.InfoTemplate;
    infoTemplate.setTitle("Details");
    infoTemplate.setContent(getInfoWindowContent);

    var resultFeatures = results.features;
    
    for (var i=0, length = resultFeatures.length; i < length; i++) {
        // Add point to map to show location
        var graphic = resultFeatures[i];
        graphic.setSymbol(symbol).setInfoTemplate(infoTemplate);
    ....
   

function connectPoints(points){    
    for (var i = 0, len = points.length; i < len; i++)
    {
        var polyline = new esri.geometry.Polyline(map.spatialReference);
        var thesePoints = [points[i], points[i+1]];
        
        polyline.addPath(thesePoints);

        //create graphic
        var line = new esri.Graphic(polyline, new esri.symbol.SimpleLineSymbol());
        
        line.setInfoTemplate(getLineInfoWindowContent(pointsArray[i], pointsArray[i+1]));
        
        //add graphic to map
        map.graphics.add(line);
        ....

Outcomes