[IGN-6877] How to trigger scripts from Perspective Map Popups

Hello all,

I'm using the perspective map component to show site locations, with a popup displaying KPI details for the site when the marker is clicked.

The issue I'm having is with any scripts firing from the map popup itself. Events seem to trigger correctly when running the embedded view itself in a test page I set up, but nothing happens when the view is in the map marker popup.

I tried sort of backdooring with a boolean on a custom property and a tag change script but that didn't work either. Is this something that just doesn't work with the map component's popups?

We can't help with scripts unless you supply the script that is having an issue. There's no reason a script should work in the Designer but not a Client - even in the Map popup.

I made the script as simple as possible for testing purposes, not passing any parameters, etc.

The site details button fires this event script on mouse down:
image

When the button is pressed from a test page I created for the view everything works as expected, but nothing happens when I click the same button from the map popup:
image

Do you see anything(errors/exceptions) logged in the Gateway when this script is supposed to be executing but is not working? Try including some logging before the navigation call to make it clear in the logs when the script is being executed.

No error messages show up.

I used the console to check for the event firing earlier with the following script:

 system.perspective.print('Event Triggered')
 system.perspective.navigate('/monitor/site-overview')

Which again, worked fine in the designer when on the embedded view, but nothing happens when I perform the same action on the view when it's embedded in the Map Popup.

The component behaviors are the same in the Perspective session:
If I click the button when it's on its own page, it navigates as expected; nothing happens from the map page.

You're omitting potentially important pieces from your screenshots. What component is your onMouseDown script attached to, and what is the first listed Action for this Event?

The first listed action was the toggle script I mentioned previously and is currently disabled. I'm not intentionally omitting information, just trying to limit my post to what's actually relevant.

The scripts work everywhere other than in the map popup view, which is why I was questioning the functionality on the component.

If length isn't an issue I can give a full rundown of what params are present and what the intended actions are but it might be a bit cumbersome to read through.

Thanks for bringing this issue to our attention. We have since reproduced the issue and a bug has been created.

1 Like

Awesome, thanks guys. :slight_smile:

1 Like

As a workaround can you change from an onMouseDown event to an actionPerformed event on the button. I tested that locally and works as expected.

1 Like