first 4 LayerToggleButtons work in 2nd controller, the rest don't

1117
8
Jump to solution
01-10-2020 03:57 PM
EricRuberson1
New Contributor III

I'm using 7 instances of the LayerToggleButton widget. One of my coworkers got them set up and working in a FoldableTheme Header Controller.

But there's enough icons between these icons, several other widget icons, and the search bar we've got, that icons are being added to a sort of overflow menu. So I was asked to move the icons for our LayerToggleButtons into a panel off on the left side.

So I made a new controller widget (after some issues) and got all of the icons loading in a new widget off on the left side of the screen like so:

(one of the non-programmers in the pipeline gave me these placeholder icons, they're ugly but that's irrelevant)

The problem is only the first 4 icons work.

The rest fail the same way, with a message like below

I thought that maybe the issue was that because the first 4 icons get loaded into the HeaderController while the last 3 get relegated to the overflow sub menu in the header controller, and somehow the last three aren't properly loaded, but I have no idea how to check that or fix it.

I tried having these 7 widget icons be exclusively be controlled by my new HotButtonController instead of consecutively by both controllers (by giving the two controllers their own individual lists of controlled widgets), but that just caused all 7 widget icons to fail to execute with the same error message as below.

So I am at a loss as to what to try next and here I am.

FAILURE MESSAGE:

fail to open widget LayerToggleButton.

setBusyIndicator@http://server/webappbuilder/apps/17/widgets/LayerToggleButton/Widget.js?wab_dv=2.12...

toggleLayer/<@http://server/webappbuilder/apps/17/widgets/LayerToggleButton/Widget.js?wab_dv=2.12:303:18

hitch/<@https://js.arcgis.com/3.28/init.js:64:337 map@https://js.arcgis.com/3.28/init.js:72:238

toggleLayer@http://server/webappbuilder/apps/17/widgets/LayerToggleButton/Widget.js?wab_dv=2.12:300:...

onOpen@http://server/webappbuilder/apps/17/widgets/LayerToggleButton/Widget.js?wab_dv=2.12:267:16

openWidget@http://server/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:549:18

_postWidgetStartup@http://server/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:1160:12

_hitchArgs/<@https://js.arcgis.com/3.28/init.js:64:15 c@https://js.arcgis.com/3.28/init.js:120:235

openWidget@http://server/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:540:18 _showWidgetContent/<@http://server/webappbuilder/apps/17/widgets/HotButtonController/Widget.js?wab_dv=2.12:184:32

The bottom most line of what I copy/pasted: where line 184 in HotButtonController/widcget.js corresponds to line 28 below. I can confirm that the console log on line 3 below triggers for every one of the 7 widget icons. They are failing mysteriously in the Layer Toggle Button part of the code. 

      _showWidgetContent: function(iconConfig) {
        console.log("_showWidgetContent: iconConfig.id:");
        console.log(iconConfig.id);

        if(this.openedWidgetId) {
          //this.widgetManager.openWidget(openedWidgetId); //We need to toggle the widget on because of odd behavior with the widget, before we can close it again
        ////this.panelManager.closePanel(this.openedWidgetId + '_panel').then(this.widgetManager.openWidget(openedWidgetId).then(this.panelManager.closePanel(this.openedWidgetId + '_panel')));
          //We need to toggle the widget on because of odd behavior with the widget, before we can close it again
          
          
          var isLayerToggleWidget= false;
          if(this.widgetManager.getWidgetById(this.openedWidgetId).name="LayerToggleButton"){
            isLayerToggleWidget=true;
          }

          if(isLayerToggleWidget){
            this.widgetManager.openWidget(this.openedWidgetId);
            this.openedWidgetId= '';
          }
          else{
            this.panelManager.closePanel(this.openedWidgetId + '_panel');
          }
        }
        if(!iconConfig.inPanel) {
          var self = this;
          this.widgetManager.loadWidget(iconConfig).then(function(widget) {
            // add code to display off-panel widgets here
            self.widgetManager.openWidget(widget);
          });
        }

        var self = this;
        if ( this.config.panel != null){
          this.panelManager.showPanel(iconConfig).then(function (widget) {
            // the panel displays successfully
            self.own(on.once(widget, 'close', function () {
              domClass.remove(self.activeIconNode, 'jimu-state-active');
              self.activeIconNode = null;
            }));
          }, function (err) {
            // the panel failed to display
            console.log("the panel failed to display");
            console.log(err);
          });
        }    
        this.openedWidgetId = iconConfig.id;
      },

I've attached the LayerToggleButton widget.js I've got (widget.js) and my HotButtonConttroller's widget.js. I dont think anyone made any changes to the LayerToggleButton widget code and that it corresponds to the latest release, but it is there for reference. And the HotButtonController code is there just in case.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Eric,

  the error trace is still showing the setbusyindicator error that was fixed in the 2.14 release of the Layer Toggle Button widget. Are you sure you update to the latest version for this particular app (i.e. apps/17/widgets/LayerToggleButton/Widget.js)?

View solution in original post

0 Kudos
8 Replies
RobertScheitlin__GISP
MVP Emeritus

Eric,

   It seems that the widget is having issues with layer that are toggled if their direct parent is just a group layer. I will be releasing a fix for this soon, now that I am aware of the issue.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Eric,

  Try version 2.14

0 Kudos
EricRuberson1
New Contributor III

Robert. I just added it in. I swapped out the entire contents of my widgets/LayerToggleButton folder with the folder nested inside the zip file. I did not swap in the headercontroller or onscreenwidgetincon.js as I do not need that functionality. I will do so if you think it will fix the issue.

My issue is still the same. the first 4 buttons seem to work fine. the rest don't. At the end of this message, I've posted the error trace which comes up when I click on the 5th one.

Could the issue be because the first controller widget I'm using has so many buttons that stuff is overflowing, and that overflowing mechanism is doing something to disable the overflowing widgets? Because the only buttons that dont work right are the ones that are going to the overflow popup grid

All these buttons work fine:

These 3 don't:

And my 2nd controller:

Error trace when I click the 5th widget button

fail to open widget LayerToggleButton. setBusyIndicator@http://[mymachine]/webappbuilder/apps/17/widgets/LayerToggleButton/Widget.js?wab_dv=2.12:203:11

toggleLayer/<@http://[mymachine]/webappbuilder/apps/17/widgets/LayerToggleButton/Widget.js?wab_dv=2.12:305:18

hitch/<@https://js.arcgis.com/3.28/init.js:64:337

map@https://js.arcgis.com/3.28/init.js:72:238

toggleLayer@http://[mymachine]/webappbuilder/apps/17/widgets/LayerToggleButton/Widget.js?wab_dv=2.12:302:15

onOpen@http://[mymachine]/webappbuilder/apps/17/widgets/LayerToggleButton/Widget.js?wab_dv=2.12:269:16

openWidget@http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:549:18

_postWidgetStartup@http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:1160:12

_hitchArgs/<@https://js.arcgis.com/3.28/init.js:64:15

c@https://js.arcgis.com/3.28/init.js:120:235

openWidget@http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:540:18

_showWidgetContent/<@http://[mymachine]/webappbuilder/apps/17/widgets/HotButtonController/Widget.js?wab_dv=2.12:184:32

l@https://js.arcgis.com/3.28/init.js:108:249

k@https://js.arcgis.com/3.28/init.js:108:175

e/this.resolve@https://js.arcgis.com/3.28/init.js:110:268

loadWidget/</</<@http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:131:21

hitch/<@https://js.arcgis.com/3.28/init.js:64:337

setTimeout handler*loadWidget/</<@http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:130:25

hitch/<@https://js.arcgis.com/3.28/init.js:64:337

l@https://js.arcgis.com/3.28/init.js:108:249

e/b.then@https://js.arcgis.com/3.28/init.js:111:132

loadWidget/<@http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:111:47

hitch/<@https://js.arcgis.com/3.28/init.js:64:337

l@https://js.arcgis.com/3.28/init.js:108:249

k@https://js.arcgis.com/3.28/init.js:108:175

e/this.resolve@https://js.arcgis.com/3.28/init.js:110:268

dojo/promise/all/</</</<@https://js.arcgis.com/3.28/init.js:459:111

l@https://js.arcgis.com/3.28/init.js:108:249

k@https://js.arcgis.com/3.28/init.js:108:175

e/this.resolve@https://js.arcgis.com/3.28/init.js:110:268

l@https://js.arcgis.com/3.28/init.js:108:249

k@https://js.arcgis.com/3.28/init.js:108:175

e/this.resolve@https://js.arcgis.com/3.28/init.js:110:268

loadWidgetClass/<@http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:158:13

hitch/<@https://js.arcgis.com/3.28/init.js:64:337

ja@https://js.arcgis.com/3.28/init.js:28:441

ha/<@https://js.arcgis.com/3.28/init.js:29:186

ka@https://js.arcgis.com/3.28/init.js:29:53

ha@https://js.arcgis.com/3.28/init.js:29:128

q@https://js.arcgis.com/3.28/init.js:31:346

g.injectUrl/g<@https://js.arcgis.com/3.28/init.js:36:57

EventListener.handleEvent*Oa@https://js.arcgis.com/3.28/init.js:35:37

g.injectUrl@https://js.arcgis.com/3.28/init.js:35:401

global.avoidRequireCache/require.injectUrl@http://[mymachine]/webappbuilder/apps/17/env.js:320:17

ra@https://js.arcgis.com/3.28/init.js:33:72

e@https://js.arcgis.com/3.28/init.js:10:437

oa/<@https://js.arcgis.com/3.28/init.js:20:62

ka@https://js.arcgis.com/3.28/init.js:29:53

oa@https://js.arcgis.com/3.28/init.js:20:49

ab/<@https://js.arcgis.com/3.28/init.js:34:129

e@https://js.arcgis.com/3.28/init.js:10:437

ab@https://js.arcgis.com/3.28/init.js:34:112

q@https://js.arcgis.com/3.28/init.js:31:187

g.injectUrl/g<@https://js.arcgis.com/3.28/init.js:36:57

EventListener.handleEvent*Oa@https://js.arcgis.com/3.28/init.js:35:37

g.injectUrl@https://js.arcgis.com/3.28/init.js:35:401

global.avoidRequireCache/require.injectUrl@http://[mymachine]/webappbuilder/apps/17/env.js:320:17

ra@https://js.arcgis.com/3.28/init.js:33:72

e@https://js.arcgis.com/3.28/init.js:10:437

oa/<@https://js.arcgis.com/3.28/init.js:20:62

ka@https://js.arcgis.com/3.28/init.js:29:53

oa@https://js.arcgis.com/3.28/init.js:20:49

Qa@https://js.arcgis.com/3.28/init.js:20:397

g@https://js.arcgis.com/3.28/init.js:11:107

loadWidgetClass@http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:157:14

loadWidget@http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:107:19

_showWidgetContent@http://[mymachine]/webappbuilder/apps/17/widgets/HotButtonController/Widget.js?wab_dv=2.12:182:30

_createIconNode/<@http://[mymachine]/webappbuilder/apps/17/widgets/HotButtonController/Widget.js?wab_dv=2.12:151:16

EventListener.handleEvent*p@https://js.arcgis.com/3.28/init.js:121:320

dojo/on/</l.parse@https://js.arcgis.com/3.28/init.js:124:217

l@https://js.arcgis.com/3.28/init.js:123:165

_createIconNode@http://[mymachine]/webappbuilder/apps/17/widgets/HotButtonController/Widget.js?wab_dv=2.12:143:18

postCreate@http://[mymachine]/webappbuilder/apps/17/widgets/HotButtonController/Widget.js?wab_dv=2.12:40:16

create@https://js.arcgis.com/3.28/init.js:356:361

postscript@https://js.arcgis.com/3.28/init.js:355:104

c/<@https://js.arcgis.com/3.28/init.js:201:129

createWidget@http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:321:16

loadWidget/</<@http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:113:35

hitch/<@https://js.arcgis.com/3.28/init.js:64:337

l@https://js.arcgis.com/3.28/init.js:108:249

k@https://js.arcgis.com/3.28/init.js:108:175

e/this.resolve@https://js.arcgis.com/3.28/init.js:110:268

loadWidgetResources/<@http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:190:13

hitch/<@https://js.arcgis.com/3.28/init.js:64:337

l@https://js.arcgis.com/3.28/init.js:108:249

k@https://js.arcgis.com/3.28/init.js:108:175

e/this.resolve@https://js.arcgis.com/3.28/init.js:110:268

dojo/promise/all/</</</<@https://js.arcgis.com/3.28/init.js:459:111

l@https://js.arcgis.com/3.28/init.js:108:249

k@https://js.arcgis.com/3.28/init.js:108:175

e/this.resolve@https://js.arcgis.com/3.28/init.js:110:268

l@https://js.arcgis.com/3.28/init.js:108:249

k@https://js.arcgis.com/3.28/init.js:108:175

e/this.resolve@https://js.arcgis.com/3.28/init.js:110:268

doLoad/<@http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:1220:17

l@https://js.arcgis.com/3.28/init.js:108:249

k@https://js.arcgis.com/3.28/init.js:108:175

e/this.resolve@https://js.arcgis.com/3.28/init.js:110:268

WidgetManager.js:551:19

    openWidget http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:551

    _postWidgetStartup http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:1160

    _hitchArgs https://js.arcgis.com/3.28/init.js:64

    c https://js.arcgis.com/3.28/init.js:120

    openWidget http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:540

    _showWidgetContent http://[mymachine]/webappbuilder/apps/17/widgets/HotButtonController/Widget.js?wab_dv=2.12:184

    l https://js.arcgis.com/3.28/init.js:108

    k https://js.arcgis.com/3.28/init.js:108

    resolve https://js.arcgis.com/3.28/init.js:110

    loadWidget http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:131

    hitch https://js.arcgis.com/3.28/init.js:64

    (Async: setTimeout handler)

    loadWidget http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:130

    hitch https://js.arcgis.com/3.28/init.js:64

    l https://js.arcgis.com/3.28/init.js:108

    then https://js.arcgis.com/3.28/init.js:111

    loadWidget http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:111

    hitch https://js.arcgis.com/3.28/init.js:64

    l https://js.arcgis.com/3.28/init.js:108

    k https://js.arcgis.com/3.28/init.js:108

    resolve https://js.arcgis.com/3.28/init.js:110

    all https://js.arcgis.com/3.28/init.js:459

    l https://js.arcgis.com/3.28/init.js:108

    k https://js.arcgis.com/3.28/init.js:108

    resolve https://js.arcgis.com/3.28/init.js:110

    l https://js.arcgis.com/3.28/init.js:108

    k https://js.arcgis.com/3.28/init.js:108

    resolve https://js.arcgis.com/3.28/init.js:110

    loadWidgetClass http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:158

    hitch https://js.arcgis.com/3.28/init.js:64

    ja https://js.arcgis.com/3.28/init.js:28

    ha https://js.arcgis.com/3.28/init.js:29

    ka https://js.arcgis.com/3.28/init.js:29

    ha https://js.arcgis.com/3.28/init.js:29

    q https://js.arcgis.com/3.28/init.js:31

    g https://js.arcgis.com/3.28/init.js:36

    (Async: EventListener.handleEvent)

    Oa https://js.arcgis.com/3.28/init.js:35

    injectUrl https://js.arcgis.com/3.28/init.js:35

    injectUrl http://[mymachine]/webappbuilder/apps/17/env.js:320

    ra https://js.arcgis.com/3.28/init.js:33

    e https://js.arcgis.com/3.28/init.js:10

    oa https://js.arcgis.com/3.28/init.js:20

    ka https://js.arcgis.com/3.28/init.js:29

    oa https://js.arcgis.com/3.28/init.js:20

    ab https://js.arcgis.com/3.28/init.js:34

    e https://js.arcgis.com/3.28/init.js:10

    ab https://js.arcgis.com/3.28/init.js:34

    q https://js.arcgis.com/3.28/init.js:31

    g https://js.arcgis.com/3.28/init.js:36

    (Async: EventListener.handleEvent)

    Oa https://js.arcgis.com/3.28/init.js:35

    injectUrl https://js.arcgis.com/3.28/init.js:35

    injectUrl http://[mymachine]/webappbuilder/apps/17/env.js:320

    ra https://js.arcgis.com/3.28/init.js:33

    e https://js.arcgis.com/3.28/init.js:10

    oa https://js.arcgis.com/3.28/init.js:20

    ka https://js.arcgis.com/3.28/init.js:29

    oa https://js.arcgis.com/3.28/init.js:20

    Qa https://js.arcgis.com/3.28/init.js:20

    g https://js.arcgis.com/3.28/init.js:11

    loadWidgetClass http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:157

    loadWidget http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:107

    _showWidgetContent http://[mymachine]/webappbuilder/apps/17/widgets/HotButtonController/Widget.js?wab_dv=2.12:182

    _createIconNode http://[mymachine]/webappbuilder/apps/17/widgets/HotButtonController/Widget.js?wab_dv=2.12:151

    (Async: EventListener.handleEvent)

    p https://js.arcgis.com/3.28/init.js:121

    parse https://js.arcgis.com/3.28/init.js:124

    l https://js.arcgis.com/3.28/init.js:123

    _createIconNode http://[mymachine]/webappbuilder/apps/17/widgets/HotButtonController/Widget.js?wab_dv=2.12:143

    postCreate http://[mymachine]/webappbuilder/apps/17/widgets/HotButtonController/Widget.js?wab_dv=2.12:40

    create https://js.arcgis.com/3.28/init.js:356

    postscript https://js.arcgis.com/3.28/init.js:355

    c https://js.arcgis.com/3.28/init.js:201

    createWidget http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:321

    loadWidget http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:113

    hitch https://js.arcgis.com/3.28/init.js:64

    l https://js.arcgis.com/3.28/init.js:108

    k https://js.arcgis.com/3.28/init.js:108

    resolve https://js.arcgis.com/3.28/init.js:110

    loadWidgetResources http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:190

    hitch https://js.arcgis.com/3.28/init.js:64

    l https://js.arcgis.com/3.28/init.js:108

    k https://js.arcgis.com/3.28/init.js:108

    resolve https://js.arcgis.com/3.28/init.js:110

    all https://js.arcgis.com/3.28/init.js:459

    l https://js.arcgis.com/3.28/init.js:108

    k https://js.arcgis.com/3.28/init.js:108

    resolve https://js.arcgis.com/3.28/init.js:110

    l https://js.arcgis.com/3.28/init.js:108

    k https://js.arcgis.com/3.28/init.js:108

    resolve https://js.arcgis.com/3.28/init.js:110

    doLoad http://[mymachine]/webappbuilder/apps/17/jimu.js/WidgetManager.js?wab_dv=2.12:1220

    l https://js.arcgis.com/3.28/init.js:108

    k https://js.arcgis.com/3.28/init.js:108

    resolve https://js.arcgis.com/3.28/init.js:110

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Eric,

   When I put enough widgets in the header controller to overflow to the more menu the toggle buttons in the more menu still work for me. So it must be something in your second controller code that is the issue.

0 Kudos
EricRuberson1
New Contributor III

Robert here it is in its entirety.

I canibalized the About widget for this one's template.

///////////////////////////////////////////////////////////////////////////
// Copyright © Esri. All Rights Reserved.
//
// Licensed under the Apache License Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////

define(['dojo/_base/declare',
    'dojo/_base/html',
    'dojo/query',
    'dojo/dom-class',
    'dojo/on',
    'dojo/_base/lang',
    './common',
    'dijit/_WidgetsInTemplateMixin',
    'jimu/utils',
    'jimu/PoolControllerMixin',
    'jimu/BaseWidget'
  ],
  function(declare, html, query, domClass, on, lang, common, _WidgetsInTemplateMixin, jimuUtils, PoolControllerMixin, BaseWidget) {
    var clazz = declare([BaseWidget, _WidgetsInTemplateMixin, PoolControllerMixin], {
      baseClass: 'jimu-widget-hotbuttoncontroller',
      allConfigs: [],
      openedWidgetId: '',
      activeIconNode: null,

      postCreate: function () {
        this.inherited(arguments);
        this.allConfigs = this.getAllConfigs();
        for(var i = 0; i < this.allConfigs.length; i++) {
          this._createIconNode(this.allConfigs[i]);
        }

      },

      startup: function () {
        this.inherited(arguments);
        if (common.isDefaultContent(this.config)) {
          this.config.hotbuttoncontroller.hotbuttoncontrollerContent = common.setDefaultContent(this.config, this.nls);
        }
        this.isOpen = true;
        this.openAtStartAysn = true;
        this.resize();
        jimuUtils.focusFirstFocusByTheme(this, this.customContentNode);
        this.openAtStartAysn = false;

        //Focus customContentNode
        //use firstTabNode for passing focus state to customContentNode (FF)
        this.own(on(this.splashContainerNode, 'focus', lang.hitch(this, function(){
          this.firstTabNode.focus();
        })));
        this.own(on(this.firstTabNode, 'focus', lang.hitch(this, function(){
          this.customContentNode.focus();
        })));

        jimuUtils.setWABLogoDefaultAlt(this.customContentNode);
      },

      resize: function () {
        this._resizeContentImg();
      },

      onOpen: function(){
        this.isOpen = true;
        //resolve issue #15086 when network is so slow.
        setTimeout(lang.hitch(this, function(){
          this.isOpen = false;
        }), 50);
      },

      _resizeContentImg: function () {
        //record current activeElement before resizing
        var _activeElement = document.activeElement;
        html.empty(this.customContentNode);

        var hotbuttoncontrollerContent = html.toDom(this.config.hotbuttoncontroller.hotbuttoncontrollerContent);
        html.place(hotbuttoncontrollerContent, this.customContentNode);
        // single node only(no DocumentFragment)
        if (this.customContentNode.nodeType && this.customContentNode.nodeType === 1) {
          var contentImgs = query('img', this.customContentNode);
          if (contentImgs && contentImgs.length) {
            contentImgs.forEach(lang.hitch(this, function (img) {
              var isNotLoaded = ("undefined" !== typeof img.complete && false === img.complete) ? true : false;
              if (isNotLoaded) {
                this.own(on(img, 'load', lang.hitch(this, function () {
                  this._resizeImg(img);
                })));
              } else {
                this._resizeImg(img);
              }
            }));
          }

          //Init dom's attrs and events again because doms are new after resizing.
          var focusableNodes = jimuUtils.getFocusNodesInDom(this.domNode);
          if(focusableNodes.length){
            jimuUtils.initFirstFocusNode(this.domNode, focusableNodes[0]);
            jimuUtils.initLastFocusNode(this.domNode, focusableNodes[focusableNodes.length - 1]);
          }

          //focus firstNode if required
          if(this.isOpen || html.isDescendant(_activeElement, this.domNode)){
            var firstNode = jimuUtils.getFirstFocusNode(this.domNode);
            jimuUtils.focusFirstFocusByTheme(this, firstNode);
            this.isOpen = false;
          }
        }
      },
      _createIconNode: function(iconConfig, targetNode) {
        var iconNode, iconImage;
        if(!targetNode) targetNode = this.containerNode;
  
        iconNode = document.createElement('DIV');
        iconNode.className = 'icon-node';
        if(iconConfig.icon) {
          iconImage = document.createElement('img');
          iconImage.src = iconConfig.icon;
        }
        if(iconConfig.label) {
          iconNode.title = iconConfig.label;
          iconImage.alt = iconConfig.label;
        }
  
        iconNode.appendChild(iconImage);
        targetNode.appendChild(iconNode);
         // check if the widget is set to open at start
        if (iconConfig.openAtStart) {
          this.activeIconNode = iconNode;
          domClass.add(iconNode, 'jimu-state-active');
          this._showWidgetContent(iconConfig);
        }
        var self = this;

        this.own(on(iconNode, 'click', function() {
          query('.jimu-state-active', self.domNode).removeClass('jimu-state-active');
          if(self.activeIconNode === this) {
            self.panelManager.closePanel(iconConfig.id + '_panel');
            self.activeIconNode = null;
            return;
          }
          domClass.add(this, 'jimu-state-active');
          self._showWidgetContent(iconConfig);
          self.activeIconNode = this;
        }));
        return iconNode;
      },

      _showWidgetContent: function(iconConfig) {
        console.log("_showWidgetContent: iconConfig.id:");
        console.log(iconConfig.id);

        if(this.openedWidgetId) {
          //this.widgetManager.openWidget(openedWidgetId); //We need to toggle the widget on because of odd behavior with the widget, before we can close it again
        ////this.panelManager.closePanel(this.openedWidgetId + '_panel').then(this.widgetManager.openWidget(openedWidgetId).then(this.panelManager.closePanel(this.openedWidgetId + '_panel')));
          //We need to toggle the widget on because of odd behavior with the widget, before we can close it again
          
          
          var isLayerToggleWidget= false;
          if(this.widgetManager.getWidgetById(this.openedWidgetId).name="LayerToggleButton"){
            isLayerToggleWidget=true;
          }

          if(isLayerToggleWidget){
            this.widgetManager.openWidget(this.openedWidgetId);
            this.openedWidgetId= '';
          }
          else{
            this.panelManager.closePanel(this.openedWidgetId + '_panel');
          }
        }
        if(!iconConfig.inPanel) {
          var self = this;
          this.widgetManager.loadWidget(iconConfig).then(function(widget) {
            // add code to display off-panel widgets here
            self.widgetManager.openWidget(widget);
          });
        }

        var self = this;
        if ( this.config.panel != null){
          this.panelManager.showPanel(iconConfig).then(function (widget) {
            // the panel displays successfully
            self.own(on.once(widget, 'close', function () {
              domClass.remove(self.activeIconNode, 'jimu-state-active');
              self.activeIconNode = null;
            }));
          }, function (err) {
            // the panel failed to display
            console.log("the panel failed to display");
            console.log(err);
          });
        }    
        this.openedWidgetId = iconConfig.id;
      },




      _resizeImg: function(img) {
        var customBox = html.getContentBox(this.customContentNode);
        var imgSize = html.getContentBox(img);
        if (imgSize && imgSize.w && imgSize.w >= customBox.w) {
          html.setStyle(img, {
            maxWidth: (customBox.w - 20) + 'px', // prevent x scroll
            maxHeight: (customBox.h - 40) + 'px'
          });
        }
      }
    });
    return clazz;
  });‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Eric,

  the error trace is still showing the setbusyindicator error that was fixed in the 2.14 release of the Layer Toggle Button widget. Are you sure you update to the latest version for this particular app (i.e. apps/17/widgets/LayerToggleButton/Widget.js)?

0 Kudos
EricRuberson1
New Contributor III

Robert, thank you for your responses. I've had to backburner this while working on other issues with our project, so it's now a good 2 forks back from my current version. When I get back onto this particular task, I will start with a fresh download of 2.14

0 Kudos
EricRuberson1
New Contributor III

Robert, I'm marking your answer as correct. I dont actually know if it fixes the issue I was having, but we've moved completely off of this direction and into having icons up in the Header Controller. We're having other issues with that which I may put into another question. In looking into those issues, I checked line-by-line the code that you had updated. It looks like the bulk of it was in the HeaderController's widget, which I hadn't pushed into the version 17 folder indicated above, so I definitely hadn't applied your fix.

0 Kudos