<?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 Trigger widget button &amp;quot;onclick&amp;quot; event programmatically in ArcGIS Web AppBuilder Questions</title>
    <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/trigger-widget-button-quot-onclick-quot-event/m-p/1136097#M21824</link>
    <description>&lt;P&gt;I am experimenting the the WAB Launchpad theme and would like to open/close various widgets programmatically.&amp;nbsp; I have attempted to fire the onclick event in the following code but cannot seam to access the needed node. I am not a web developer and only have a little experience with JavaScript and none using dojo.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, I can understand how to access the widget information when using "this" in the widget code itself, but how do you access "this" for the widget from outside the widget.&amp;nbsp; I have experimented with the dom but the onclick event is not accessible via my crude attempts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;div class="jimu-anchorbar-iconitem jimu-float-leading" id="uniqName_11_0" widgetid="uniqName_11_0" settingid="widgets_Legend_Widget_18" style="margin-left: 7px;"&amp;gt;
  &amp;lt;div role="button" class="icon-item icon-item-background0 dockable" data-dojo-attach-point="iconItemNode" data-dojo-attach-event="onclick:_onNodeClick,onkeydown:_onNodeKeydown" tabindex="3801" aria-label="Legend" style="width: 40px; height: 40px;"&amp;gt;
    &amp;lt;img class="icon" src="/webappbuilder/apps/14/widgets/Legend/images/icon.png?wab_dv=2.23" data-dojo-attach-point="imgNode" alt="Legend" style="width: 20px; height: 20px;"&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;div class="status" data-dojo-attach-point="iconItemStatus"&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The HTML code excerpt is from one of the widgets on the AnchorBarControler&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LanceCole_0-1642811141022.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/32033i442BF79C82E18C38/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LanceCole_0-1642811141022.png" alt="LanceCole_0-1642811141022.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 22 Jan 2022 00:27:18 GMT</pubDate>
    <dc:creator>LanceCole</dc:creator>
    <dc:date>2022-01-22T00:27:18Z</dc:date>
    <item>
      <title>Trigger widget button "onclick" event programmatically</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/trigger-widget-button-quot-onclick-quot-event/m-p/1136097#M21824</link>
      <description>&lt;P&gt;I am experimenting the the WAB Launchpad theme and would like to open/close various widgets programmatically.&amp;nbsp; I have attempted to fire the onclick event in the following code but cannot seam to access the needed node. I am not a web developer and only have a little experience with JavaScript and none using dojo.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, I can understand how to access the widget information when using "this" in the widget code itself, but how do you access "this" for the widget from outside the widget.&amp;nbsp; I have experimented with the dom but the onclick event is not accessible via my crude attempts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;div class="jimu-anchorbar-iconitem jimu-float-leading" id="uniqName_11_0" widgetid="uniqName_11_0" settingid="widgets_Legend_Widget_18" style="margin-left: 7px;"&amp;gt;
  &amp;lt;div role="button" class="icon-item icon-item-background0 dockable" data-dojo-attach-point="iconItemNode" data-dojo-attach-event="onclick:_onNodeClick,onkeydown:_onNodeKeydown" tabindex="3801" aria-label="Legend" style="width: 40px; height: 40px;"&amp;gt;
    &amp;lt;img class="icon" src="/webappbuilder/apps/14/widgets/Legend/images/icon.png?wab_dv=2.23" data-dojo-attach-point="imgNode" alt="Legend" style="width: 20px; height: 20px;"&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;div class="status" data-dojo-attach-point="iconItemStatus"&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The HTML code excerpt is from one of the widgets on the AnchorBarControler&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LanceCole_0-1642811141022.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/32033i442BF79C82E18C38/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LanceCole_0-1642811141022.png" alt="LanceCole_0-1642811141022.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jan 2022 00:27:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/trigger-widget-button-quot-onclick-quot-event/m-p/1136097#M21824</guid>
      <dc:creator>LanceCole</dc:creator>
      <dc:date>2022-01-22T00:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger widget button "onclick" event programmatically</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/trigger-widget-button-quot-onclick-quot-event/m-p/1136136#M21825</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/201429"&gt;@LanceCole&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please refer to this post for assistance.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/web-appbuilder/sample-code/close-widget-programmatically.htm" target="_blank"&gt;https://developers.arcgis.com/web-appbuilder/sample-code/close-widget-programmatically.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/web-appbuilder/api-reference/widgetmanager.htm" target="_blank"&gt;https://developers.arcgis.com/web-appbuilder/api-reference/widgetmanager.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jan 2022 11:58:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/trigger-widget-button-quot-onclick-quot-event/m-p/1136136#M21825</guid>
      <dc:creator>AnjulPandey</dc:creator>
      <dc:date>2022-01-22T11:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger widget button "onclick" event programmatically</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/trigger-widget-button-quot-onclick-quot-event/m-p/1136248#M21828</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/191828"&gt;@AnjulPandey&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;You got me going in the right direction for what I needed.&amp;nbsp; I want to be able to use the Launchpad Theme but with only one widget open at any time.&amp;nbsp; Made a few modifications based upon the info you provided and have it crudely working.&amp;nbsp; Need to do a lot of clean up.&lt;/P&gt;&lt;P&gt;themes\LaunchpadTheme\widgets\AnchorBarController\config.json - added the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
    "singleWidgetPanel": true
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;themes\LaunchpadTheme\widgets\AnchorBarController\widget.js - added lines 6-10 (near 650 in source of the&amp;nbsp;&lt;SPAN&gt;_onDockableNodeClick method&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;        panelId = dockableItem.config.id + '_panel';
        if(dockableItem.isOpen){
          dockableItem.setPanelIndex(this._calPanelIndex());
          panelConfig = dockableItem.getConfigForPanel();
          
          if(this.config.singleWidgetPanel){
            this.openedIds.forEach(function (widgetId){
              this.panelManager.closePanel(widgetId + "_panel");
            }, this);
          }

          this.panelManager.showPanel(panelConfig).then(lang.hitch(this, function(panel){
            console.log("position: ", panelConfig.panel.position)
            panel.setPosition(panelConfig.panel.position);
            aspect.after(panel, 'onClose', lang.hitch(this, function(){
              dockableItem.setOpened(false);
              this._removeFromOpenedIds(dockableItem.config.id);
              if(dockableItem.iconItemNode){
                dockableItem.iconItemNode.focus();
              }
            }));
          }));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;themes\LaunchpadTheme\widgets\AnchorBarController\BaseIconItem.js - set&amp;nbsp;position.index = 0 on line 5.&amp;nbsp; Will clean this up later to use the config settings.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;getConfigForPanel: function(){
      var panelConfig = lang.clone(this.config);
      panelConfig.backgroundColor = this.getColor();
      panelConfig.panel.position = this._initPosition();
      panelConfig.panel.position.index = 0; //this.panelIndex;
      return panelConfig;
    },&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As noted previously I am not a developer and have no experience with Dojo and only a little with JavaScript.&amp;nbsp; Open to input and revision suggestions.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2022 00:49:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/trigger-widget-button-quot-onclick-quot-event/m-p/1136248#M21828</guid>
      <dc:creator>LanceCole</dc:creator>
      <dc:date>2022-01-24T00:49:12Z</dc:date>
    </item>
  </channel>
</rss>

