Select to view content in your preferred language

Popup does not render Graphic PopupTemplate content in 4.5

2200
7
10-18-2017 11:09 AM
BradleyChappell
Emerging Contributor

I built a web application using the JS 4.4 API and have recently upgraded the JS source to 4.5. When I changed the script and style sources to 4.5, my Popup quit rendering the content.

Here is the content of the Graphic's popup template (which is logged during runtime to the console):

<div class='popupEntry'>Network: {Network}</div><div class='popupEntry'>County: {County}</div><div class='popupEntry'>Residential Buildings: {Residential_Bldgs}</div>

Here is the popup rendered in 4.4:

Popup 4.4

Here is the  popup rendered in 4.5:

Popup 4.5

Also, my custom action is present in each, but only works in 4.4.

In 4.5 it throws an error "a is null" in MapView.js 1771:486

Browser: Firefox

0 Kudos
7 Replies
ToddAtkins
Frequent Contributor

I stumbled across this in the API documentation the other day. I wonder if that has some relation to your issue?

As of version 4.5, if the popupTemplate is not defined on the Graphic, it will use the graphic layer popupTemplate.

0 Kudos
BradleyChappell
Emerging Contributor

Thanks for the response.  I am defining the popupTemplate for each Graphic though, so it should use that as opposed to the graphic layer. Actually, I'm not even creating a graphic layer.  Instead, I am just setting my Graphics[] to the View.Popup.Features property.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

You should try adding them to a Graphics Layer than and define the PopupTemplate for the GL and not the graphic as the docs now state for 4.5.

0 Kudos
BradleyChappell
Emerging Contributor

I will try a graphics layer, but the keyword in the documentation is "if":

As of version 4.5, if the popupTemplate is not defined on the Graphic, it will use the graphic layer popupTemplate.

I don't see anything that states the popupTemplate MUST be defined in the graphic layer.

RobertScheitlin__GISP
MVP Emeritus

Ok I totally missed the “if”.

0 Kudos
YueZhou1
Emerging Contributor

I used to set popupTemplate for each graphic (view.popupTemplate does not work) in version 4.4. Now it's broken in 4.5 and I don't know how to fix it.

view.on("click", function (event) {

   event.stopPropagation();

   var ext = pointToExtent(view, event.mapPoint, 10);

   view.popup.features = findPointsInExtent(ext);

   if (view.popup.features.length > 0)

      { view.popup.open({location: event.mapPoint}); }

});

0 Kudos
BradleyChappell
Emerging Contributor

I just came back to this problem after a few weeks of doing other things.  Now, the popup renders the graphic template without any changes to my code.

ESRI must have made some update to their API.

Can someone from ESRI confirm any update to the 4.5 API?

0 Kudos