Infowindow is not entirely visible

572
4
02-18-2011 07:24 AM
JamesBurton
New Contributor
I have a map displayed in a fixed-width table, 600px wide, which has an infoWindow showing details of features. If a feature is near the edge of the map, the inforWindow is not always placed correctly, so part of it is invisible. How do I make the infowindow place itself so that it can all be seen? Thanks.
0 Kudos
4 Replies
derekswingley1
Frequent Contributor
Are you using something like this to show your info window:
map.infoWindow.show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint));
0 Kudos
PaulForbess
New Contributor III
We are having the same problem, and yes we are using code that looks like that.
0 Kudos
derekswingley1
Frequent Contributor
Post a simple example that demonstrates the issue?
0 Kudos
JamesBurton
New Contributor
Are you using something like this to show your info window:
map.infoWindow.show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint));


Yes, that is the code I'm using. Here's a simplified example:


function createMap() {
    try {
        //instantiate the map and add layers etc
 Utils.mapAndBaseLayer(CWLSettings.cityExtent);

 dojo.connect(map, "onLoad", function() {dojo.connect(map, "onClick", executeQueryTask);});
 dojo.connect(map.infoWindow, "onHide", function() {map.graphics.clear();});
 queryTask = new esri.tasks.QueryTask(cwlService.Url + '/' + shapeLayerID);

 query = new esri.tasks.Query();
        query.returnGeometry = true;
        query.outFields = ["NAME", "LAYER"];

    } catch (ex) {
        console.log(ex);
    }
}


function executeQueryTask(evt) {
    map.infoWindow.hide();
    map.graphics.clear();
    featureSet = null;

    query.geometry = evt.mapPoint;

    //Execute task and call showResults on completion
    queryTask.execute(query, function(fset) {
        if (fset.features.length === 1) {
            showFeature(fset.features[0],evt);
        } else if (fset.features.length !== 0) {
            showFeatureSet(fset,evt);
        }
    });
}

function showFeature(feature,evt) {
    map.graphics.clear();

    var symbol = ... //simple marker symbol
    feature.setSymbol(symbol);

    var attr = feature.attributes;
    var title = attr.NAME ? attr.NAME : attr.LAYER;
    var content = title;
    map.graphics.add(feature);
    map.infoWindow.setTitle(title);
    map.infoWindow.setContent(content);

    (evt) ? map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint)) : null;
}
0 Kudos