infoTemplate not working in Select with Feature Layer sample

1967
1
Jump to solution
10-04-2013 06:03 AM
by Anonymous User
Not applicable
So I've implemented the Select with Feature Layer sample. The buffering, feature selecting with the buffer all work as expected. Query results are returned, graphic symbology is performed but when I click on a graphic within the buffer, the infoTemplate doesn't appear. Nothing happens. Related code is below.

var infraFeatureLayer = new FeatureLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/0",{
          mode: FeatureLayer.MODE_SELECTION,
          infoTemplate: new InfoTemplate("Block: ${BLOCK}", "${*}"),
          outFields: ["POP2000","HOUSEHOLDS","HSE_UNITS", "TRACT", "BLOCK"]
        });

        // selection symbol used to draw the selected census block points within the buffer polygon
        var isymbol = new SimpleMarkerSymbol(
          SimpleMarkerSymbol.STYLE_CIRCLE,
          12,
          new SimpleLineSymbol(
            SimpleLineSymbol.STYLE_NULL,
            new Color([247, 34, 101, 0.9]),
            1
          ),
          new Color([207, 34, 171, 0.5])
        );
        infraFeatureLayer.setSelectionSymbol(isymbol);
        map.addLayer(infraFeatureLayer);

   gsvc = new GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");

function fireInfra() {
   infraHandler = dojo.connect(map,"onClick",findInfrastructure); 
}

function findInfrastructure(evt) {
        var paramsI = new BufferParameters();
        paramsI.geometries  = [ evt.mapPoint ];
        paramsI.distances = [ 1 ];
        paramsI.unit = GeometryService.UNIT_STATUTE_MILE;
  gsvc.on("buffer-complete", function(){
      dojo.disconnect(infraHandler);
     });
        gsvc.buffer(paramsI, showInfraBuffer);
}

function showInfraBuffer(geometries) {      
      map.graphics.clear();
      // draw the buffer geometry on the map as a map graphic
      var symbol = new SimpleFillSymbol(
       SimpleFillSymbol.STYLE_NULL,
       new SimpleLineSymbol(
        SimpleLineSymbol.STYLE_SHORTDASHDOTDOT,
        new Color([105,105,105]),
        2
       ),new Color([255,255,0,0.25])
      );
   //end symbol
   var bufferGeometry = geometries[0]
      var graphic = new Graphic(bufferGeometry, symbol);
      map.graphics.add(graphic);
   //do query with buffer
   var query = new Query();
      query.geometry = bufferGeometry;
   query.returnGeometry = true;
      infraFeatureLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW, function(results){
     var popTotal = 0;
          for (var x = 0; x < results.length; x++) {
            popTotal = popTotal + results.attributes['POP2000'];
          }  
  alert(popTotal);
      });
}
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable
Yet another self-inflicted wound causing this. Found the problem.

where the map was instantiated, I had:

showInfoWindowOnClick:false;

Set that to true and, viola!!

rg

View solution in original post

0 Kudos
1 Reply
by Anonymous User
Not applicable
Yet another self-inflicted wound causing this. Found the problem.

where the map was instantiated, I had:

showInfoWindowOnClick:false;

Set that to true and, viola!!

rg
0 Kudos