I am probably missing something simple but when I try to access the Layer View of a Feature Layer using view.whenLayerView I am getting the error "No layerview has been found for the layer" .
I am just working on this on my local machine. Can anyone see what I have wrong?
Solved! Go to Solution.
It's not working as you expect since you've put the addMany method inside the view.when function. If you also move the view.whenLayerView inside that function, it will work.
view.when(function () {
map.addMany([pointLayer]);
view.whenLayerView(pointLayer).then(layerView => {
console.log("LV loaded");
})
.catch(function (error) {
console.log(error);
});
});
Or you can move the addMany method outside the view.when function and it will work
map.addMany([pointLayer]);
view.when(function () {
console.log("View loaded");
});
view.whenLayerView(pointLayer).then(layerView => {
console.log("LV loaded");
})
.catch(function (error) {
console.log(error);
});
It's not working as you expect since you've put the addMany method inside the view.when function. If you also move the view.whenLayerView inside that function, it will work.
view.when(function () {
map.addMany([pointLayer]);
view.whenLayerView(pointLayer).then(layerView => {
console.log("LV loaded");
})
.catch(function (error) {
console.log(error);
});
});
Or you can move the addMany method outside the view.when function and it will work
map.addMany([pointLayer]);
view.when(function () {
console.log("View loaded");
});
view.whenLayerView(pointLayer).then(layerView => {
console.log("LV loaded");
})
.catch(function (error) {
console.log(error);
});
Perfect! Thank you.