Select to view content in your preferred language

Call dojo/on in Web App builder

964
5
Jump to solution
05-30-2018 01:29 PM
Juan_ManuelAngel_Cuartas
Emerging Contributor

Hi Guys, i set this code line in the mapManager.js in the WAB Application

_show2DWebMap: function(appConfig) {
//should use appConfig instead of this.appConfig, because appConfig is new.
// if (appConfig.portalUrl) {
// var url = portalUrlUtils.getStandardPortalUrl(appConfig.portalUrl);
// agolUtils.arcgisUrl = url + "/sharing/content/items/";
// }

on(this.map, "load", lang.hitch(this, function() {
//do something to addedLayers
}));

but i get this error:

The big problem is that i have declare dojo on the define function, i dont know what is the error, thank you.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Juan,

   You need to be inside the mapDeferred.then portion of the _show2dWebMap and then the map is already loaded so no need to watch for load event.

View solution in original post

0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Emeritus

Juan,

   You need to be inside the mapDeferred.then portion of the _show2dWebMap and then the map is already loaded so no need to watch for load event.

0 Kudos
Juan_ManuelAngel_Cuartas
Emerging Contributor

Hi Robert i use this line in the mapDeferreded and nothing happends,  on(map,"load", function() { alert("Hello !!"); });

But when i try with the event layer-add they trigger the same times that layer i have in my web map but i just want to trigger once.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Juan,


  As I mentioned the ma is already loaded when you are in the mapDeferred so listening for load will not work. If you only want to listen for an event once the you use on.once instead of just on.

0 Kudos
Juan_ManuelAngel_Cuartas
Emerging Contributor

Robert other question, do you know how to get the name of a featureLayer in WAB to  use the propertie lyrQuakes.setDefinitionExpression("MAGNITUDE >= 2.0"); when the user load the WAB ??Robert Scheitlin, GISP

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Juan,


  You use map.getLayer( layerid ). This is not the layer name but the layers id. 

0 Kudos