WebScene popup

3433
5
Jump to solution
03-29-2016 07:46 AM
MeganWirth
Occasional Contributor

Following the example Work with slides in a WebScene I was able to successfully add my own scene with slides. but need help configuring  the popup. The point data i am using only has a couple fields i.e. x, y, and location. The popup appears to include the location as the title but does not display anything else. would appreciate any help with this.

Thanks in advance.

0 Kudos
1 Solution

Accepted Solutions
KristianEkenes
Esri Regular Contributor

Hmmm. This doesn't look right. I can see the popupTemplate in the SceneViewer but as you said, it doesn't display correctly in the app. Could you file a bug report for this so we can take some time to look at what's going on in this case behind the scenes?

In the mean time, you can do the following work around with  the API. Since the view is a promise and doesn't resolve until the scene's resources have loaded, you can chain another function and set a custom popup template on the layer.

.then(function(){
        var content = "{*}";
        var title = "Whatever you want";
        
        var pTemplate = {
          content: content,
          title: title
        };
                
        var lyrs = view.map.layers;
        
        var droneLyr = lyrs.find(function(lyr){
          return lyr.id === "3f14aa6ac0a94ebeb7794744b1578cb1";
        });
        
        droneLyr.popupTemplate = pTemplate;
     });

Here's a live view at the updated app on jsbin: JS Bin - Collaborative JavaScript Debugging

Hope that helps!

View solution in original post

5 Replies
KristianEkenes
Esri Regular Contributor

Hmmm. This doesn't look right. I can see the popupTemplate in the SceneViewer but as you said, it doesn't display correctly in the app. Could you file a bug report for this so we can take some time to look at what's going on in this case behind the scenes?

In the mean time, you can do the following work around with  the API. Since the view is a promise and doesn't resolve until the scene's resources have loaded, you can chain another function and set a custom popup template on the layer.

.then(function(){
        var content = "{*}";
        var title = "Whatever you want";
        
        var pTemplate = {
          content: content,
          title: title
        };
                
        var lyrs = view.map.layers;
        
        var droneLyr = lyrs.find(function(lyr){
          return lyr.id === "3f14aa6ac0a94ebeb7794744b1578cb1";
        });
        
        droneLyr.popupTemplate = pTemplate;
     });

Here's a live view at the updated app on jsbin: JS Bin - Collaborative JavaScript Debugging

Hope that helps!

MeganWirth
Occasional Contributor

Kristian, thanks for the fast reply and work around its appreciated!! I will send the report.

0 Kudos
MeganWirth
Occasional Contributor

It appears i cant log the report. when i try and submit support request form i get the following error "You do not have access to request a support case."

0 Kudos
MeganWirth
Occasional Contributor

Kristian Ekenes​ if i added a hyperlink field to the drone layer how would I format it to behave like a hyperlink in the code you provided?

Thanks in advance

0 Kudos
KristianEkenes
Esri Regular Contributor

I'm not sure about the issue with not having access to request a support case...

But the hyperlink should be created automatically when displaying the attributes in a table as this app does. It's not working in beta3, but it has already been implemented on our end and you'll see the change reflected when we deploy 4.0 final.