I am trying to implement an action that zooms to layer's full entent. Is there a way to access the related layer?
I found some info: https://totalapis.github.io/api-reference/esri-widgets-LayerList-ListItem.html
but could not implement it.
For instance, I am trying to access the layer shown with the arrow mark when actions (3 dots) triggered
let layerList = new LayerList({
            view: view,
            container:"sideDiv",
            listItemCreatedFunction: defineActions    
        });
        var item = event.item;
          
          item.actionsSections = [
            [
              {
                title: "Go to full extent",
                className: "esri-icon-zoom-out-fixed",
                id: "full-extent"
              },
            ],
          ];
view.when(function() {  
            layerList.on("trigger-action", function(event) {
            // The layer visible in the view at the time of the trigger.
            
            // Capture the action id.
            var id = event.action.id;
            activeLayer = layerList.layer //this does not work
            
            if (id === "full-extent") {
              // If the full-extent action is triggered then navigate
              // to the full extent of the visible layer.
              view.goTo(activeLayer.fullExtent); //this either
            } 
            });
Thanks
Solved! Go to Solution.
The LayerList doesn't have a layer property. You'll have to get the layer information from the event.
view.goTo(event.item.layer.fullExtent);However, this will only work with single feature layers, not Group Layers, as in this sample
The LayerList doesn't have a layer property. You'll have to get the layer information from the event.
view.goTo(event.item.layer.fullExtent);However, this will only work with single feature layers, not Group Layers, as in this sample
Hi @KenBuja
is it possible to access to attribute table with the event? Where can I get the properties of an event? I could not find any resource.
I would like to implement an action that opening attribute table but can not do it
alert(event.item.layer.isTable)returns false
