Infotemplate not working

872
4
01-29-2012 05:17 PM
XueLing
New Contributor
Hi,

My info template is not working at all currently and it looks like this :

var stadium = [];

var symbol = new esri.symbol.PictureMarkerSymbol('/images/icons/stadium.png', 25, 25);

var infoTemplate = new esri.InfoTemplate();
infoTemplate.setTitle("Stadium");

infoTemplate.setContent("This is a stadium.");


var graphic = PointGraphic;
graphic.setSymbol(symbol);
graphic.setInfoTemplate(infoTemplate);
stadium.push(OneMap.map.graphics.add(graphic));

Can anyone help and tell me what's wrong with it because it was working fine 2 months ago.

Thanks and regards,
Xueling.
0 Kudos
4 Replies
derekswingley1
Frequent Contributor
What changed?
0 Kudos
XueLing
New Contributor
Hi there,

What do you mean by "What changed?" As in what is not working?
2 months ago, its working which means that when I click on the icon on my map, the infoTemplate will pop out with the specific information. But now, when I click on it, nothing appears at all.


Thanks and regards.
0 Kudos
derekswingley1
Frequent Contributor
2 months ago, its working which means that when I click on the icon on my map, the infoTemplate will pop out with the specific information. But now, when I click on it, nothing appears at all.


If it used to work, but now doesn't now, something changed. Can you post your code?
0 Kudos
XueLing
New Contributor
Hi there,

var stadium = [];

var symbol = new esri.symbol.PictureMarkerSymbol('/images/icons/stadium.png', 25, 25);

var infoTemplate = new esri.InfoTemplate();
infoTemplate.setTitle("Stadium");

infoTemplate.setContent("This is a stadium.");


var graphic = PointGraphic;
graphic.setSymbol(symbol);
graphic.setInfoTemplate(infoTemplate);
stadium.push(OneMap.map.graphics.add(graphic));

dojo.connect(themeGraphicsLayer, "onClick", function (evt) {
                mashup.GetDataForCallout(evt.graphic, "", function (results) {
                    var formattedResults = formatResults(results);
                    map.infoWindow.setContent(formattedResults);
                    map.infoWindow.show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint));
                });
            })

        }

function formatResults(resultObject) {
            var nameVal = ""
            for (var i = 0; i < resultObject.length; i++) {
                nameVal = nameVal + "<br>"
                nameVal += "<strong>" + resultObject["NAME"] + "</strong>" + "<br/>"
                nameVal += resultObject["DESCRIPTION"] + "<br/>"
                nameVal += "<a href=" + resultObject["HYPERLINK"] + " target='_blank'>More Info</a>" + "<br/>"

                if (resultObject["PHOTOURL"] != "") {
                    nameVal += "<img src=" + resultObject["PHOTOURL"] + "></img>" + "<br/>"
                }
                else {
                    nameVal += "<br/>"
                }
                nameVal += resultObject["ADDRESSBLOCKHOUSENUMBER"] + " " + resultObject["ADDRESSSTREETNAME"] + " " + resultObject["ADDRESSBUILDINGNAME"] + " " + resultObject["ADDRESSFLOORNUMBER"] + " " + resultObject["ADDRESSUNITNUMBER"] + "<br/>"
                nameVal += "Singapore " + resultObject["ADDRESSPOSTALCODE"] + "<br/>"
            }
            return nameVal
        }

Thanks and regards.
0 Kudos