<?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 One widget hijacking another in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/one-widget-hijacking-another/m-p/795111#M4591</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have 2 widgets: a Manage Folders widget and a Task Manager widget. They sit next to each other in the navbar of my Web AppBuilder version 1.2 app. There are several other widgets as well. If I launch Task Manager after any of the other widgets, there are no problems. However, if I launch the Manage Folders Widget, close it, and then open the Task Manager widget, I immediately notice that a dropdown is sized a little larger than normal. The dropdown controls what task items are displayed in a grid below it. Normally, if I select a new item from the dropdown, it triggers and on change event that loads the tasks for the new selection into the grid. Now however, when I select a new item from the dropdown, nothing happens; the items from the previous selection (or default) remain the same.In investigating this issue in Chrome DevTools, I noticed that when I make a change in the Task Managers dropdown,&amp;nbsp;the&amp;nbsp;on change event&amp;nbsp;gets triggered but then it goes to the 'loadData' function in the widget.js file for the previously closed Manager Folders widget. Note: they both have a function called 'loadData'. How could this be?! Any suggestions (other than renaming one of the loadData functions? Why would this be happening? Could this be something set incorrectly in one of the .json files?&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Apr 2020 17:37:36 GMT</pubDate>
    <dc:creator>JustinBridwell2</dc:creator>
    <dc:date>2020-04-08T17:37:36Z</dc:date>
    <item>
      <title>One widget hijacking another</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/one-widget-hijacking-another/m-p/795111#M4591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have 2 widgets: a Manage Folders widget and a Task Manager widget. They sit next to each other in the navbar of my Web AppBuilder version 1.2 app. There are several other widgets as well. If I launch Task Manager after any of the other widgets, there are no problems. However, if I launch the Manage Folders Widget, close it, and then open the Task Manager widget, I immediately notice that a dropdown is sized a little larger than normal. The dropdown controls what task items are displayed in a grid below it. Normally, if I select a new item from the dropdown, it triggers and on change event that loads the tasks for the new selection into the grid. Now however, when I select a new item from the dropdown, nothing happens; the items from the previous selection (or default) remain the same.In investigating this issue in Chrome DevTools, I noticed that when I make a change in the Task Managers dropdown,&amp;nbsp;the&amp;nbsp;on change event&amp;nbsp;gets triggered but then it goes to the 'loadData' function in the widget.js file for the previously closed Manager Folders widget. Note: they both have a function called 'loadData'. How could this be?! Any suggestions (other than renaming one of the loadData functions? Why would this be happening? Could this be something set incorrectly in one of the .json files?&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Apr 2020 17:37:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/one-widget-hijacking-another/m-p/795111#M4591</guid>
      <dc:creator>JustinBridwell2</dc:creator>
      <dc:date>2020-04-08T17:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: One widget hijacking another</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/one-widget-hijacking-another/m-p/795112#M4592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Justin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;It sounds like you are firing a publishData event on your widget and are not specifying that this data does not have a property like name or id so that you can distinguish which other widget should or should not listen for this data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my eSearch widget I have a onReceiveData function like this. As you can see in line 5 I check if the data.target equals eSearch.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;      onReceiveData&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;name&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; widgetId&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; data&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;data&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;message &lt;SPAN class="operator token"&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt; data&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;message &lt;SPAN class="operator token"&gt;===&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Deactivate_DrawTool"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
          &lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;drawBox&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;deactivate&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
        &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;data &lt;SPAN class="operator token"&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt; data&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;target &lt;SPAN class="operator token"&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt; data&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;target &lt;SPAN class="operator token"&gt;===&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'eSearch'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
          &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;data&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;geometry&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;type &lt;SPAN class="operator token"&gt;===&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"polygon"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
            esriConfig&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;defaults&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;geometryService&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;labelPoints&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;data&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;geometry&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; lang&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;hitch&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;labelPoint&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
              &lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;search&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;labelPoint&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
            &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
          &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;search&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;data&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;geometry&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
          &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
        &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
      &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as the sizes being larger... It sounds like you have defined some custom css rule that does not have a high enough specificity, meaning it is being applied to all other widgets too.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:10:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/one-widget-hijacking-another/m-p/795112#M4592</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T09:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: One widget hijacking another</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/one-widget-hijacking-another/m-p/795113#M4593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Robert- So, I'm trying to figure out where to apply your suggestion. The Task Manager on change events fires and then it calls `thisWidget.loadData()` like this:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;dijit.byId('subprojectSelect').on('change', function (e) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; thisWidget.loadData(e, proj_type_obj);&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;At this point I expect it to to the Task Manager "loadData()" function but it instead goes to the Manage Folder "loadData" function. Here is the start of the Task Manager:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;loadDataTM: function (e, proj_typ) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; var p_type = proj_typ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; var proj = e;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; console.log('loadData Task Manager');&lt;BR /&gt;&amp;nbsp; &amp;nbsp; var dyfields = [{ type: "control", width: 40 },&lt;BR /&gt;&amp;nbsp; &amp;nbsp; { name: widgetConfig.taskTrackingTable.taskName, title: "Task Name", type: "text", width: 120, validate: "required" },&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;...&lt;BR /&gt;&amp;nbsp; &amp;nbsp;];&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;var def = new Deferred();&lt;BR /&gt;&amp;nbsp; &amp;nbsp;this.getTempPortal();&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;And here is the Manage Folders loadData function, which is also called with "thisWidget.loadData();":&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;onOpen: function () {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; console.log('onOpen');&lt;BR /&gt;&amp;nbsp; &amp;nbsp; this.loadData();&lt;BR /&gt; },&lt;/P&gt;&lt;P&gt;loadData: function () {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; var def = new Deferred();&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; this.getTempPortal();&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; ....&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; var projectNames = [];&lt;BR /&gt;&amp;nbsp; &amp;nbsp; var strProjectNames = "";&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; ....&lt;/P&gt;&lt;P&gt;&amp;nbsp;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Note: Task Manager doesn't call "thisWidget.loadData();" in the onOpen() function while Manage Folders does. So how could I apply your suggestions here. Would I use something unique to Task Manager widget like&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;this.dijit.byId("subprojectSelect")&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;? Would I use this unique identifier in the on change event or inside the loadData function?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Apr 2020 21:11:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/one-widget-hijacking-another/m-p/795113#M4593</guid>
      <dc:creator>JustinBridwell2</dc:creator>
      <dc:date>2020-04-08T21:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: One widget hijacking another</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/one-widget-hijacking-another/m-p/795114#M4594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was able to resolve the css issue, but am still not able to get the main issue resolved. What seems to be happening is that the "thisWidget" variable is still assigned to "ManageFolders" so that when I call:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P style="border: 0px;"&gt;dijit.byId('subprojectSelect').on('change', function (e) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; thisWidget.loadData(e, proj_type_obj);&lt;/P&gt;&lt;P style="border: 0px;"&gt;});&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;in TaskManager, it is going to the "loadData" function in ManageFolders. How can I kill the ManageFolder "thisWidget" and make sure that it is assigned to TaskManager instead?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Apr 2020 15:00:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/one-widget-hijacking-another/m-p/795114#M4594</guid>
      <dc:creator>JustinBridwell2</dc:creator>
      <dc:date>2020-04-09T15:00:08Z</dc:date>
    </item>
    <item>
      <title>Re: One widget hijacking another</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/one-widget-hijacking-another/m-p/795115#M4595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Justin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I am having difficulty following you widget logic.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where and what is the var thisWidget set to?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2020 12:56:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/one-widget-hijacking-another/m-p/795115#M4595</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2020-04-14T12:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: One widget hijacking another</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/one-widget-hijacking-another/m-p/795116#M4596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Robert,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Sorry for the delay in responding. Yes, the problem was totally caused by the variable `thisWidget`. Both widgets used `thisWidget` and they were both set to `thisWidget = this;` in `startup ()`, but ManageFolders widget also had it set to&amp;nbsp;&lt;SPAN&gt;`thisWidget = this;` in the `onOpen()` function while TaskManager did not. After much trial and error, I finally was able to resolve this with one line of code by adding&amp;nbsp;`thisWidget = this;` to the `onOpen` function in TaskManager.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Apr 2020 13:25:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/one-widget-hijacking-another/m-p/795116#M4596</guid>
      <dc:creator>JustinBridwell2</dc:creator>
      <dc:date>2020-04-15T13:25:41Z</dc:date>
    </item>
  </channel>
</rss>

