Feature Widget discriminates between feature layers

281
3
Jump to solution
05-30-2019 02:29 AM
deleted-user-wcpelUUf_XXx
New Contributor III

wokring off of the Feature Widget sample.

I was trying to do the same thing with a diffrent layer, Polygon or otherwise.

the code dosent work when any other layer is used and I am not sure what is the diffreance between them.

code with a diffrent layer:

https://codepen.io/segev-salman/pen/JqmrWw?editors=1000

code with original layer:

https://codepen.io/segev-salman/pen/GawqoN?&editable=true&editors=100

The widget responds to the mouse movement and hit test but the popup template doesn't update

I am not sure where to add the template and why the original code doesn't require one. does it come with the layer itself? 

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JackFairfield
Occasional Contributor II

It isn't working because your different layer doesn't have it's popupTemplate defined. Here is an example log of a graphic produced from the hit test:

Notice how the popupTemplate property is null?

It needs to be defined to show up in the feature widget.

Check out this jsbin.  I have modified your original example:

https://jsbin.com/nijarebega/edit?html,output

View solution in original post

3 Replies
JackFairfield
Occasional Contributor II

It isn't working because your different layer doesn't have it's popupTemplate defined. Here is an example log of a graphic produced from the hit test:

Notice how the popupTemplate property is null?

It needs to be defined to show up in the feature widget.

Check out this jsbin.  I have modified your original example:

https://jsbin.com/nijarebega/edit?html,output

View solution in original post

deleted-user-wcpelUUf_XXx
New Contributor III

thank you this is it!

Just to make sure, the original example didn't have a template in the code, does that mean that the service comes with a built in template? or am I missing something.

0 Kudos
JackFairfield
Occasional Contributor II

Yep.  The service is published with the popup template in the renderer already.

See this link:

https://services.arcgis.com/P3ePLMYs2RVChkJx/ArcGIS/rest/services/ACS_Poverty_by_Age_Boundaries/Feat...

Notice this text:

HTML Popup Type: esriServerHTMLPopupTypeAsHTMLText

This means that the popup was configured on the server when the service was published. The other layer doen't have that setup:

HTML Popup Type: esriServerHTMLPopupTypeNone

Here is the rest feature service documentation on HTML server popups:

https://developers.arcgis.com/rest/services-reference/html-popup-feature-service-.htm