Popup content

912
3
07-29-2013 12:05 AM
Dianede_lanfranchi
New Contributor
Hey,

I was browsing forum & api without any result to my query, I'd like to get the data from my popup in order to re-use it with an AJAX function. cannot find a way to do it.
I'm already moving my popup next to the map so I though it would be easy to get one of the field.

I got this part of code from an arcgis tuto
                    var content =feature.getContent();
                    registry.byId("leftPane").set("content", content);


[HTML]<div id="leftPane" data-dojo-type="dijit/layout/ContentPane"
            data-dojo-props="region:'center'"></div>[/HTML]

The content properly get into the leftPane DIV but whenever I try to use it another way than this one I got a 'object HTMLDivElement' as result.

thanks
0 Kudos
3 Replies
JanJeske
New Contributor III
Hey if you display the Popup with features try
popup.getSelectedFeature()
. You'll get a feature object back. If you want all features wich are set to the popup look at the dom ;).... in my case
popup.features
(is an array)

if you use a template u can use:
var template = new esri.InfoTemplate("","${Status:compare}");


in this case Status is a returned var and compare is the function.
function compare(value, key, data) 
{
var content = "The Status of XYZ is" + data.Status;
registry.byId("leftPane").set("content", content); //show in left Pane
return content; //show in Popup 
}


btw:
i createt a simple popup with
popup = new esri.dijit.Popup({
   markerSymbol:popupmarker,    
   fillSymbol: new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 2), new dojo.Color([255,255,0,0.25]))
}, dojo.create("div"));



Hope it helps 😉
0 Kudos
Dianede_lanfranchi
New Contributor
It helped !
thanks you !
0 Kudos
SorinCiolofan
New Contributor
Hi, I have the same problem as described below

Hey,

I was browsing forum & api without any result to my query, I'd like to get the data from my popup in order to re-use it with an AJAX function. cannot find a way to do it.
I'm already moving my popup next to the map so I though it would be easy to get one of the field.

I got this part of code from an arcgis tuto
                    var content =feature.getContent();
                    registry.byId("leftPane").set("content", content);


[HTML]<div id="leftPane" data-dojo-type="dijit/layout/ContentPane"
            data-dojo-props="region:'center'"></div>[/HTML]

The content properly get into the leftPane DIV but whenever I try to use it another way than this one I got a 'object HTMLDivElement' as result.

thanks


feature is obtained popup.getSelectedFeature() - accordingly to the JS ArcGIS API reference https://developers.arcgis.com/en/javascript/jsapi/popup.html it should return a Graphic object.
then when trying to use feature.getContent() on the documentation https://developers.arcgis.com/en/javascript/jsapi/graphic-amd.html says we should get a String but actually seems an Object is returned and not a String.
Seems there is a problem somewhere.
0 Kudos