mtdave

Info Window blank on intial map.infoWindow.show()

Discussion created by mtdave on May 16, 2012
Latest reply on May 17, 2012 by mtdave
I am doing an identify task and take the first returned feature, symbolize it, add an Info Window Template and then add the graphic to the map. Finally I tell the Info Window to Show using the identify point. On first showing the Info Window always is blank. If I close the Info Window and then open again it is filled in correctly. On subsequent identifies it is filled in correctly. Any idea whats up?

This is designed to work with the currently selected (active) layer in a dynamic map service. We'd like the Info Window to display on click.

function showFeature(response) {
    map.graphics.clear();    

    var layer = response[0];
    var feature = layer.feature;

    var symbol;
    if (layer.geometryType == 'esriGeometryPolygon') {
        symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID,
            new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,
            new dojo.Color([0,0,125,0.6]), 2),new dojo.Color([0,0,255,0.6]));
    }
    else if (layer.geometryType == 'esriGeometryPolyline') {
        symbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,
            new dojo.Color([0,0,125,0.6]), 5);
    }
    else if (layer.geometryType == 'esriGeometryPoint' || layer.geometryType == 'esriGeometryMultipoint') {
        symbol =  new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10,
           new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,
           new dojo.Color([0,0,255]), 2),
           new dojo.Color([0,0,125,0.6]));
    }
    else {
        Ext.MessageBox.alert("INFORMATION", "Geometry not symbolized");
        return;
    }
    
    feature.setSymbol(symbol);

    var infoTemplate = new esri.InfoTemplate();
    infoTemplate.setTitle(layer.layerName);
    
    var contStr = "<table>";
    for (var prop in feature.attributes) {
        contStr += "<tr><td><b>" + prop + ":</b></td><td>${" + prop + "}</td></tr>";
    }
    contStr += "</table>";

    infoTemplate.setContent(contStr);

    feature.setInfoTemplate(infoTemplate);

    map.graphics.add(feature);
    map.infoWindow.show(identPnt);
    //setTimeout(function () { map.infoWindow.show(identPnt); }, 1000);
}

Outcomes