I have a case where the "load" event is not being fired for a feature layer (v 3.7). This happens when the app is opened a new window or tab. When doing a full refresh, it triggers again. I do not get any errors-events on this.Update: this happens in some instances of IE10, but it has happened in IE11 aswell.Also, the docs on the "load"-event states the following:Fires after layer properties for the layer are successfully populated. This event must be successful before the layer can be added to the map.
What does this mean, do I have to add the layer to the map inside the event handler for "load" ? If so, this is not what's being done in the examples (e.g. this).Here is a stripped version of my code:
App.mainLayer = new FeatureLayer(mapConfig.featureServiceUrl + "/0", {
id: mapConfig.featureLayerID,
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ["*"],
visible: true,
});
App.mainLayer.on("error", function (err) {
console.error("Error loading layer: ", e.stack);
});
App.mainLayer.setDefinitionExpression(layerFilterExpression);
App.mainLayer.on("mouse-over", function () {
App.map.setMapCursor("pointer");
});
App.mainLayer.on("mouse-out", function () {
App.map.setMapCursor("default");
});
App.mainLayer.on("load", explLayerLoadedHandler);
function explLayerLoadedHandler(evt) {
// sometimes not firing
console.log("Layer loaded.");
...
}