<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ListItem ellipsis expanded event in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/listitem-ellipsis-expanded-event/m-p/1157302#M76760</link>
    <description>&lt;P&gt;I think the layerlist example with associated actions shows you how to do this.&amp;nbsp; This is the URL for it:&lt;/P&gt;&lt;P&gt;&lt;A title="LayerList Actions" href="https://developers.arcgis.com/javascript/latest/sample-code/widgets-layerlist-actions/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/sample-code/widgets-layerlist-actions/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure if you are asking about something else but this handles customizing the 3 ellipse button on the LayerList itself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Mar 2022 14:30:26 GMT</pubDate>
    <dc:creator>JeffreyWilkerson</dc:creator>
    <dc:date>2022-03-24T14:30:26Z</dc:date>
    <item>
      <title>ListItem ellipsis expanded event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/listitem-ellipsis-expanded-event/m-p/1157249#M76759</link>
      <description>&lt;P&gt;I would like to do something whenever a user clicks on the ellipsis (i.e. three dots) on a list item to expand the different actions but I couldn't find an associated event.&amp;nbsp; &amp;nbsp;Is there a way I can respond to respond to this?&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 13:17:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/listitem-ellipsis-expanded-event/m-p/1157249#M76759</guid>
      <dc:creator>GaryB</dc:creator>
      <dc:date>2022-03-24T13:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: ListItem ellipsis expanded event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/listitem-ellipsis-expanded-event/m-p/1157302#M76760</link>
      <description>&lt;P&gt;I think the layerlist example with associated actions shows you how to do this.&amp;nbsp; This is the URL for it:&lt;/P&gt;&lt;P&gt;&lt;A title="LayerList Actions" href="https://developers.arcgis.com/javascript/latest/sample-code/widgets-layerlist-actions/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/sample-code/widgets-layerlist-actions/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure if you are asking about something else but this handles customizing the 3 ellipse button on the LayerList itself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 14:30:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/listitem-ellipsis-expanded-event/m-p/1157302#M76760</guid>
      <dc:creator>JeffreyWilkerson</dc:creator>
      <dc:date>2022-03-24T14:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: ListItem ellipsis expanded event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/listitem-ellipsis-expanded-event/m-p/1157346#M76766</link>
      <description>&lt;P&gt;I looked at this, I think it only shows how to handle the events where you actually click on one of the actions and not the ellipsis that expands the actions.&amp;nbsp; Sorry if I got this wrong, I'm somewhat new to the JSAPI.&amp;nbsp; Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 15:17:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/listitem-ellipsis-expanded-event/m-p/1157346#M76766</guid>
      <dc:creator>GaryB</dc:creator>
      <dc:date>2022-03-24T15:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: ListItem ellipsis expanded event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/listitem-ellipsis-expanded-event/m-p/1157409#M76771</link>
      <description>&lt;P&gt;The 3 ellipse button performs the 'action' of the ListItem.&amp;nbsp; If you look at the code, there is a function created called 'defineActions'.&amp;nbsp; This is then used in the LayerList creation by specifying the property 'listItemCreatedFunction' as this function called 'defineActions'.&amp;nbsp; This process will pull in the objects created through the 'defineActions' function.&lt;/P&gt;&lt;P&gt;If you look at the 'defineActions' function, it first determines if this is the layer that should have these actions defined by looking at the ListItem Title property:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if (item.title === "US Demographics") {&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then it sets up what will happen when you click on the 3 ellipse button for this ListItem using the 'actionSections' property:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;item.actionsSections = [
              [
                {
                  title: "Go to full extent",
                  className: "esri-icon-zoom-out-fixed",
                  id: "full-extent"
                },
                {
                  title: "Layer information",
                  className: "esri-icon-description",
                  id: "information"
                }
              ],
              [
                {
                  title: "Increase opacity",
                  className: "esri-icon-up",
                  id: "increase-opacity"
                },
                {
                  title: "Decrease opacity",
                  className: "esri-icon-down",
                  id: "decrease-opacity"
                }
              ]
            ];
          }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And also, even though it goes beyond your '3 ellipse' question, the function then adds the opacity slider to each sub item by searching to see if it is a child of a ListItem and has a parent:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if(item.children.length &amp;gt; 1 &amp;amp;&amp;amp; item.parent){
            const slider = new Slider({
              min: 0,
              max: 1,
              precision: 2,
              values: [ 1 ],
              visibleElements: {
                labels: true,
                rangeLabels: true
              }
            });

            item.panel = {
              content: slider,
              className: "esri-icon-sliders-horizontal",
              title: "Change layer opacity"
            }

            slider.on("thumb-drag", (event) =&amp;gt; {
              const { value } = event;
              item.layer.opacity = value;
            })
          }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is what is used to setup the functions under the 3 ellipse button, as well as what happens with the opacity slider underneath.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Later on in the code, after the &lt;U&gt;view&lt;/U&gt; has had a chance to finish rendering (under 'view.when(() =&amp;gt; {'), and after the &lt;U&gt;LayerList&lt;/U&gt; (layerList) has been created, there is the definition of what to do when the &lt;U&gt;"trigger-action"&lt;/U&gt; event is fired.&amp;nbsp; This is what determines what will happen when an item from the 3 ellipse button drop down gets selected because the 'id' used in the &lt;U&gt;actionsSections&lt;/U&gt; corresponds to the 'id' used in the &lt;U&gt;trigger-action&lt;/U&gt; event bubble.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;         layerList.on("trigger-action", (event) =&amp;gt; {
            // The layer visible in the view at the time of the trigger.
            const visibleLayer = USALayer.visible ? USALayer : censusLayer;

            // Capture the action id.
            const id = event.action.id;

            if (id === "full-extent") {
              // if the full-extent action is triggered then navigate
              // to the full extent of the visible layer
              view.goTo(visibleLayer.fullExtent)
              .catch((error) =&amp;gt; {
                if (error.name != "AbortError"){
                  console.error(error);
                }
              });
            } else if (id === "information") {
              // if the information action is triggered, then
              // open the item details page of the service layer
              window.open(visibleLayer.url);
            } else if (id === "increase-opacity") {
              // if the increase-opacity action is triggered, then
              // increase the opacity of the GroupLayer by 0.25

              if (demographicGroupLayer.opacity &amp;lt; 1) {
                demographicGroupLayer.opacity += 0.25;
              }
            } else if (id === "decrease-opacity") {
              // if the decrease-opacity action is triggered, then
              // decrease the opacity of the GroupLayer by 0.25

              if (demographicGroupLayer.opacity &amp;gt; 0) {
                demographicGroupLayer.opacity -= 0.25;
              }
            }
          });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully this is answers your question.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 16:27:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/listitem-ellipsis-expanded-event/m-p/1157409#M76771</guid>
      <dc:creator>JeffreyWilkerson</dc:creator>
      <dc:date>2022-03-24T16:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: ListItem ellipsis expanded event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/listitem-ellipsis-expanded-event/m-p/1158578#M76837</link>
      <description>&lt;P&gt;Thanks for your response Jeffrey.&amp;nbsp; I think I understand everything you described and am already doing that.&amp;nbsp; What I really want, and maybe this is something no one else needs and is not possible, is to do something when someone clicks on the ellipses (not when (and if) they click on one of the contained actions.&amp;nbsp; Is that even possible?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 20:42:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/listitem-ellipsis-expanded-event/m-p/1158578#M76837</guid>
      <dc:creator>GaryB</dc:creator>
      <dc:date>2022-03-28T20:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: ListItem ellipsis expanded event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/listitem-ellipsis-expanded-event/m-p/1159190#M76856</link>
      <description>&lt;P&gt;I guess you could attach to the 3 ellipse button itself.&amp;nbsp; This is from an example that Esri was showing how to attach to the back button of the Editor widget, but it seems to work here as well.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Use the LayerList's 3 ellipse button to do something different
layerList.when(function (results) {
    console.log("isFulfilled");
    let arrComp = document.getElementsByClassName('esri-layer-list__item-actions-menu-item');
    if (arrComp.length &amp;gt; 0) {

        // Add a tooltip for the 3 ellipse button
        arrComp[0].setAttribute("title", "Something to happen here");

        // Add a listerner to listen for when the editor's back button is clicked
        arrComp[0].addEventListener('click', function (evt) {
            // Prevent the default behavior for the back button and
            //    instead remove the editor and reopen the popup
            evt.preventDefault();
            alert("pressed the 3 ellipse button");
        });
    }
}, function (error) {
    console.log("Error in layerList.when")
});&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 29 Mar 2022 23:47:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/listitem-ellipsis-expanded-event/m-p/1159190#M76856</guid>
      <dc:creator>JeffreyWilkerson</dc:creator>
      <dc:date>2022-03-29T23:47:40Z</dc:date>
    </item>
  </channel>
</rss>

