AnsweredAssumed Answered

infoWindow content not clearing as expected from clusterLayer

Question asked by schlot on Mar 2, 2015
Latest reply on Mar 3, 2015 by sarahclark

I have a clusterLayer based on the point clustering example: 

Toward the top, I define my infoTemplate and call the function to generate the clusters:

      infoTemplateContent = "<b>Status: ${FlagStatusDescription}</b><br>"
        +"Type: ${ItemFunctionDescription}<br>"
        +"Agency: ${AgencyAcronym}<br>"+
        "Address: ${EntityLocationAddress1}<br>"
        +"City: ${EntityLocationCity}<br>"
        + "IP address: ${II_IPAddress}";
        infoTemplate = new InfoTemplate();
        infoTemplate.setTitle("Server ID: ${Item_Name}");


Here's the function

  function createCluster(){
    var queryTask = new QueryTask(pathName+"/ArcGIS/rest/services/myService/MapServer/1");
    var query = new Query();
    query.returnGeometry = true;
    query.where = '1=1';
    query.outFields = ["*"];
    queryTask.on("complete", function(results){
        var inputInfo = {}; =, function(feature){
          var point = feature.geometry;
          var att = feature.attributes; 
          var pointX = feature.geometry.x;
          var pointY = feature.geometry.y;
            return {
                "x": pointX,
                "y": pointY,
                "attributes": att

        var singleServerSymbol =  new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 10, 
         new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([0,0,0]), 1),new Color([0,205,0,0.25]));
        // cluster layer that uses OpenLayers style clustering 
        clusterLayer = new ClusterLayer({
            "distance": 5,
            "id": "clusterLayer",
            "labelColor": "#fff",
            "labelOffset": 10,
            "resolution": res,
            "singleColor": "#00ca00",
            "singleSym": "singleServerSymbol",           
            "singleTemplate": infoTemplate
        var renderer = new ClassBreaksRenderer(singleServerSymbol, "clusterCount");     
        var single = new PictureMarkerSymbol("", 18, 18);
        var small = new PictureMarkerSymbol("", 48, 48).setOffset(0, 15);
        var medium = new PictureMarkerSymbol("", 64, 64).setOffset(0, 15);
        var large = new PictureMarkerSymbol("", 96, 96).setOffset(0, 15);
        renderer.addBreak(0, 2, single);
        renderer.addBreak(2, 25, small);
        renderer.addBreak(25, 100, medium);
        renderer.addBreak(100, 5001, large);  
        map.addLayer(clusterLayer, 1);
        queryTask.on("error", function(err){

       map.on("key-down", function(e){
            if (e.keyCode == 27) {
function cleanUp() { 

I'm noticing that if I first click on a cluster to get information and follow that with the geocoder Widget, the infoContents that popup from my geocoder's showLocation function continues to retain the information from the clusterLayer.  It does start with,but also has the arrow indicating additional content.  When you click the arrow, you see the additional content content is the previously show information from the clusterLayer.


   function showLocation(evt){
       var symbol = new SimpleMarkerSymbol();
       symbol.setColor(new Color([255,128,0,0.75]));;
       var point = evt.result.feature.geometry;
       var graphic = new Graphic(point, symbol);;


It seems like the the cleanUp function for the clusterLayer would take care of this.  This project contains sensitive data, so I'm sorry I can't give you a link to the actual project.