jdmcc

Popup issues

Discussion created by jdmcc on Jul 14, 2011
Latest reply on Jul 26, 2011 by jdmcc
Hi all, I'm having issues making use of the new Popup and PopupMobile dijits.  What it boils down to is that I can either show a Title or I can show a description, but not both.

The way I expect it to work is like this...

I have this in my init() function (greenURL is defined elsewhere):

var popup= new esri.dijit.PopupMobile(null,dojo.create("div")); 
   
//Create map object.  Set nav to true to enable pan buttons.
map = new esri.Map("map", {
      nav: false,
      slider: true,
      displayGraphicsOnPan: true,
      infoWindow:popup
});
dojo.place(popup.domNode,map.root);

var popupTemplate = new esri.dijit.PopupTemplate({
         title: "{NAME}",description:"{DESCRIPTION}"
});

greenLayer = new esri.layers.FeatureLayer(greenURL,{mode:esri.layers.FeatureLayer.MODE_ONDEMAND,outFields: ["*"],infoTemplate:popupTemplate});

map.addLayer(greenLayer);


When I use this approach I end up with the title showing, but no description. Even if I don't use placeholders and just use strings it doesn't work.

To get around it I tried to set the infoTemplate on the feature in the results of an IdentifyTask like so (after taking out the infoTemplate option in the FeatureLayer definition above):

var template = new esri.dijit.PopupTemplate({title:"{NAME}",description:response});
feature.setInfoTemplate(template);


This gives me the opposite behaviour where the description is shown instead of the title, although in this case the title does at least show up when you expand the PopupMobile dijit.

In the examples I've checked the popup seems to 'just work' once it's defined, so I feel like I'm not understanding something about how the Popup/PopupMobile dijits work.

Outcomes