Given example:
const layerList = new LayerList({
view: view,
listItemCreatedFunction: function(event){
const item = event.item;
// displays the legend for each layer list item
item.panel = {
content: "legend"
};
}
});
Is there a way to get reference to the legend instance created this way? E.g., if I would like to set legend.respectLayerVisibility to false?
Update - current workaround I use is by creating legend instance from Legend widget myself:
const legend = new arcgis.Legend({
view: view,
respectLayerVisibility: false,
layerInfos: [
{
layer: item.layer,
},
],
});
And add legend instance created this way to the panel instead of using string 'legend':
item.panel = {
content: legend
};