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.
Solved! Go to Solution.
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.
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.
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.
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.
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
Juan,
You use map.getLayer( layerid ). This is not the layer name but the layers id.