infoWindow missing title

711
4
10-29-2012 07:27 AM
HubertLo
New Contributor
My project is a modified version of the templates (basic viewer) in ArcGIS.com and I am using v3.2 of the API. Most of the original UI features are either disabled or removed.

I used the code snippets of the Find Address sample. http://help.arcgis.com/en/webapi/javascript/arcgis/samples/locator_address/index.html to create infoWindow when the user clicks on a graphic point on the map. However I cannot get the title to show, see screen shot below:

[ATTACH=CONFIG]18801[/ATTACH]

Here is part of my codes:
Bottom of InitUI:
    map.infoWindow.resize(200,125);
    map.infoWindow.setTitle("");

map.infoWindow.setTitle("") is not doing anything...

Where the graphics are created and added to map:
        // populate the attributes
        attrPoint = {
            "Id" : AId,
            "EID" : AEID,
            "Name" : AName,
            "Xcoord" : geoPoint.x,
            "Ycoord" : geoPoint.y,
            "AssetIndex" : AIndex
        };
        
        // infoWindow
        var infoTemplate = new esri.InfoTemplate("Asset Name", "<h3>Name: ${Name}</h3><br/>Id: ${Id}<br/>EId: ${EID}<br/>FCI: ${AssetIndex}" );
        
        // Create graphic
        var graPointGraphic = new esri.Graphic(geoPoint, defaultSymbol, attrPoint, infoTemplate);

        // add to map
        map.graphics.add(graPointGraphic);
        


Although I can get fancy with the HTML inside the InfoTemplate content but it won't look as nice as if the title will just show up. What can be wrong? Is there anywhere in the template code causing the problem?

Please advise.
0 Kudos
4 Replies
AndyBurns
Occasional Contributor
Hi Just to get this right, if you specify a hard coded title ie -  map.infoWindow.setTitle("Results");  you still dont get any title?
0 Kudos
__Rich_
Occasional Contributor III
0 Kudos
HubertLo
New Contributor
I tried the hardcode. Nothing. Maybe I should try lowering it to 3.1 but I doubt that will prove much.

I suspect something has to do with the ArcGIS.com template that I am using as a base.
0 Kudos
AndyBurns
Occasional Contributor
Im unsure on arcgis online, true is i never use it as we tend to develop inhouse and we have a esri uk product that is based on the JSAPI so im unsure on what is being done in the code.

Could you not do something like this?
 //define a popup template
        var popupTemplate = new esri.dijit.PopupTemplate({
          title: "{AId}",
          fieldInfos: [
          {fieldName: "AEID", visible: true, label:"EID"},
          {fieldName: "AName", visible:true, label:"Name"},
          {fieldName: "geoPoint.x", visible:true, label:"Xcoord"},
          {fieldName: "geoPoint.y", visible:true, label:"Ycoord"},
          {fieldName: "AIndex", visible:true, label:"AssetIndex"}
          ],
        });
  
        //create a feature layer based on the feature collection
        var featureLayer = new esri.layers.FeatureLayer("YOUR SERVER HERE, CAN BE OTHER TYPES OF LAYERS", {
          mode: esri.layers.FeatureLayer.MODE_SNAPSHOT, //DEPENDS WHAT YOU WANT? MIGHT NOT BE NEEDED AS A DYNAMIC SERVICE ETC
          infoTemplate: popupTemplate,
          outFields: ["*"]
        });


If you could post some more code i will have a look.
0 Kudos