AnsweredAssumed Answered

Don't want a title on infoTemplate, but still want X to close

Question asked by schlot on Oct 21, 2015
Latest reply on Oct 28, 2015 by khutchins-esristaff

I would rather not have a title to my infoTemplate window.  I don't need to repeat the name of the location again, when I want it as part of the content and if you title it something like "Location Information", all I can think is "Duh, of course it's the location information, I just clicked it!".  If you don't set any title, you still get one, but it's set to ObjectID, which not many people care to see.

 

Trying infoTemplate.setTitle("") you still get objectid as your title.  If you set it to infoTemplate.setTitle(" "), with a blank space, then you can have no title. However now the whole header is left off, and I still want it to have an X to close, along with any next, previous arrow that might come with having multiple features selected.

 

I looked at the infoWindowLite, but I don't like the big red X as a substitute for an anchor pointing to an element.

 

I'm creating a plain infoTemplate, then populating it with a function.  I've tried map with a popup parameter and without one and that makes no difference.

 

var infoTemplate = new InfoTemplate();

 var   featureLayer =  new FeatureLayer(pathName+"/arcgis/rest/services/MDA/sampleGeocodeEdit/FeatureServer/0",{
        id:"featureLayer",
        outFields:['*'],
        infoTemplate:infoTemplate
     });
     featureLayer.renderer = renderer;
     featureLayer.setSelectionSymbol(highlightMarkerSymbol);
     
 //edit the selected feature    
     var selectQuery = new Query();
     
     on(featureLayer, "click", function(evt){
       formatString = "";
       var  objectId = evt.graphic.attributes[featureLayer.objectIdField];
        selectQuery.objectIds = [objectId];
        featureLayer.selectFeatures(selectQuery);      
     });
    on(featureLayer, "error", function (err){
      console.log("error with featureLayer; " + err.message);
    });
    
    on(featureLayer, 'selection-complete', setWindowContent);
   
function setWindowContent(results){
   map.infoWindow.resize(240, 100);
     var imageString = "<table><tr>";
     var imageStyle = "alt='site image' style='height=:40px width:40px float:left'";
     var deferred = new Deferred;
      var graphic = results.features[0];
      var  objectId = graphic.attributes[featureLayer.objectIdField]; 
         
      featureLayer.queryAttachmentInfos(objectId).then(function(response){
          var imgSrc;
          if (response.length === 0) {
              deferred.resolve("no attachments");
          }
          else {
              imgSrc = response[0].url;
              imageString += "<td><img src='" + imgSrc + "' " + imageStyle + "></td>";
              formatString += imageString;
              domConstruct.empty("attachPreviewDiv");
              domConstruct.create("img", {
                  src: imgSrc
              }, "attachPreviewDiv");
          }
          formatString += "<td><b>" + graphic.attributes.Facility + "</b><br/>" + graphic.attributes.Address + "<br/>" +
          graphic.attributes.City +  ", " + graphic.attributes.State +
          "<td></tr></table>";
          
          infoTemplate.setContent(formatString);
          infoTemplate.setTitle(" ");
      });
   map.enableMapNavigation();
 }    

Outcomes