Hexagon Geospatial
MENU

M.App Enterprise

Discuss topics with other M.App Enterprise Product pioneers and experts to get the most out of it.
Showing results for 
Search instead for 
Do you mean 
Reply
Frequent Contributor
Posts: 100
Registered: ‎01-14-2018
Accepted Solution

M.App Enterprise zoom row action not working correctly

Dear all,

 

In building a list in M.App Enterprise, I am using a row action that should zoom into the point layer named (Giza) using the following javascript:

SC.Map.setActiveLayer('Giza'); SC.Map.setSelectedElements({ROW.gid});SC.Map.setMapScale(16000); SC.Map.fitSelectedElements(); SC.Map.closeWebBrowser()

But when I click on that action button it doesn't zoom into the desired point.

 

Could you please help with that.

 

Best Regards,

Khaled

 

Staff
Posts: 840
Registered: ‎10-18-2015

Re: M.App Enterprise zoom row action not working correctly

Hi Khaled,

 

please have a look at the following tutorial (Javascript API is asynchronous, so you have to wait for the execution of the previous method):

http://community.hexagongeospatial.com/t5/M-App-Enterprise-Tutorials/Javascript-API-in-Desktop-M-App...

 

 

HTH,

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Contributor
Posts: 67
Registered: ‎05-25-2016

Re: M.App Enterprise zoom row action not working correctly

In case someone is not getting it, the key is in the " someting.then(function(){}". 

if you write your code like 

 

SC.Map.setActiveLayer('Giza'); SC.Map.setSelectedElements({ROW.gid});

 

Then javascript API will try ti execute "SC.Map.setSelectedElements()" at the same time than the "SC.Map.setActiveLaye" part and since the active layer is not set you´ll get an error.

Do you need immediate support?
If you encounter a critical issue and need immediate assistance please submit a Development Ticket through our Development Ticket Portal.