Smart M.App discussions

Looking for answers in regards to M.Apps, M.App Exchange or M.App Studio? Smart M.App Tech Discussion board is where you can search, ask your questions and assist others by sharing your knowledge. Join the conversation, connect, contribute and share.
Showing results for 
Search instead for 
Do you mean 
Reply
Frequent Contributor
Posts: 125
Registered: ‎10-16-2015

Event for changing order in legend

I'm looking for an event that's fired when the user changes the order of the layers in the legend. It doesn't appear to exist. Is this true?

Any workarounds?

Technical Evangelist
Posts: 132
Registered: ‎08-05-2015

Re: Event for changing order in legend

Hi Arjen,

 

I created a little wrapper that can be used with the internal event objects: https://bitbucket.org/snippets/pszrajbe/berbr9/smart-mapp-simple-event-wrapper

 

In order to be triggered when the legend is modified (please do mind that it happens not only when the user changes the order), please use the event wrapper that way:

 

let legendModified = new SimpleEventWrapper($GP.events.__activeLegendHandle, "legendModified");

// register
let token1 = legendModified.register((eventName, args) => console.log(eventName, args));

// in order to unregister, pass the token:
// legendModified.unregister(token1);