(API 4.11)
Hi,
as in the title i am trying to hide the layer, that the DistanceMeasureMent2D widget saves its Graphics on, in the LayerList widget. As i have no access to the layer i cannot set the listMode to hide (listMode: "hide").
Defining the operationalItems in the layerList is not the optimal solution as we wan't to change the layers dynamically via php.
A small workaround i found in the GeoNet would be to not allow any Graphicslayers in the Layerlist widget:
var layerList = new LayerList({
view: view,
container: document.createElement("div"),
listItemCreatedFunction: defineActions
});
layerList.operationalItems.on("before-add", function(event){
if (event.item.layer.type === "graphics") {
event.preventDefault();
}
});
That works fine for the moment but maybe in the Future we might want to have graphicslayers included.
Changing the LayerListView.js is also not an option.
tl;dr: How to access and hide the DistanceMeasurement2D-layer in the LayerList widget?
Solved! Go to Solution.
Hi Michael, I'm pretty sure we fixed this at 4.11 to be the default behavior. Here is a sample app that demonstrates how the 2D area and distance measurements are not added to the LayerList widget:
Hi Michael, I'm pretty sure we fixed this at 4.11 to be the default behavior. Here is a sample app that demonstrates how the 2D area and distance measurements are not added to the LayerList widget:
Thank you, i just checked it and can confirm the layer doesn't show up in the Layerlist anymore. Was just moving to 4.11 while in the process of trying to hide that item.