<?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: How to instantiate a custom widget in Web AppBuilder in javascript ? in ArcGIS Web AppBuilder Questions</title>
    <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-instantiate-a-custom-widget-in-web/m-p/567876#M15179</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok.. Thanks Robert!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Mar 2016 10:50:40 GMT</pubDate>
    <dc:creator>Vara_PrasadM_S</dc:creator>
    <dc:date>2016-03-30T10:50:40Z</dc:date>
    <item>
      <title>How to instantiate a custom widget in Web AppBuilder in javascript ?</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-instantiate-a-custom-widget-in-web/m-p/567870#M15173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using JS Web AppBuilder V 1.3 developer edition. I have created 2 custom widgets, by copying it from the sample widgets, and modified as per my needs. Updated the template, settings, css, manifest, js file, strings. First widget I have configured in config-demo.json. This widget is being rendered correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to show the second widget as content in tool tip dialog bound to some html element in first widget. I could able to bind Tool tip dialog to the html element of first widget and it is being shown correctly. However, the content is blank.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steps followed to instantiate second widget in first widget&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Added path of the widget in list of resources in 'define' of the first widget.&lt;/P&gt;&lt;P&gt;2. Added an Alias name&lt;/P&gt;&lt;P&gt;3. Created and object for this using below line&lt;/P&gt;&lt;P&gt; var selToolWidgetObj = new SelectionToolsWidget();&lt;/P&gt;&lt;P&gt;4. The object has been created successfully&lt;/P&gt;&lt;P&gt;5. debugger came to 'postCreate' event of second widget (SelectionToolsWidget)&lt;/P&gt;&lt;P&gt;6. Written below code to set this second widget as content of dijit ToolTipDialog&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this._toolTipDialog.set('content', selToolWidgetObj.domNode);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; popup.open({&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; popup: this._toolTipDialog,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; around: this.selectDiv&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;7. Tried setting object of the widget directly to 'content' property&lt;/P&gt;&lt;P&gt;8. Tried setting object of domNode of widget object as shown in step 6, no contents of second widget is rendered in UI&lt;/P&gt;&lt;P&gt;9. When I checked selToolWidgetObj.domNode in 'watch', found blank value ("") for innerHTML and also null for firstChild and firstElementChild properties.&lt;/P&gt;&lt;P&gt;10. Also, attachPoints property of the object of the second widget is an empty array.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could someone please help me how to instantiate a custom widget from another custom widget in JS Web AppBuilder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Vara Prasad.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Mar 2016 11:04:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-instantiate-a-custom-widget-in-web/m-p/567870#M15173</guid>
      <dc:creator>Vara_PrasadM_S</dc:creator>
      <dc:date>2016-03-24T11:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to instantiate a custom widget in Web AppBuilder in javascript ?</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-instantiate-a-custom-widget-in-web/m-p/567871#M15174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Vara,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Here is how esri does it in their widgets:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var ttdContent = html.create("div");
this.tooltipDialog = new TooltipDialog({
&amp;nbsp; style: "cursor:pointer",
&amp;nbsp; content: ttdContent
});
this.yourObj = new yourObj();
this.yourObj.placeAt(ttdContent);

dojoPopup.close(this.tooltipDialog);
dojoPopup.open({
&amp;nbsp; popup: this.tooltipDialog,
&amp;nbsp; around: &lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; font-size: 14px;"&gt;this.selectDiv&lt;/SPAN&gt;
});&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:27:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-instantiate-a-custom-widget-in-web/m-p/567871#M15174</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T00:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to instantiate a custom widget in Web AppBuilder in javascript ?</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-instantiate-a-custom-widget-in-web/m-p/567872#M15175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the suggestion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried it. However, the widget is not populated, the template from the template html is not populated and also, the attach points are not recognized.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, for the custom widgets, if they are templated widgets, do we need to load template html, nls and css using dojo/text!, dojo/i18n! and xstyle!, in widget javascript file ??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Vara Prasad.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Mar 2016 05:26:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-instantiate-a-custom-widget-in-web/m-p/567872#M15175</guid>
      <dc:creator>Vara_PrasadM_S</dc:creator>
      <dc:date>2016-03-28T05:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to instantiate a custom widget in Web AppBuilder in javascript ?</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-instantiate-a-custom-widget-in-web/m-p/567873#M15176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Vara,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Yes if the widget has a template then you need to reference the template using &lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;dojo/text! and you also need _WidgetBase, _TemplatedMixin in your widgets declare.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Mar 2016 12:54:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-instantiate-a-custom-widget-in-web/m-p/567873#M15176</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2016-03-28T12:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to instantiate a custom widget in Web AppBuilder in javascript ?</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-instantiate-a-custom-widget-in-web/m-p/567874#M15177</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot Robert! It helped. After I have used those dojo loaders, the html is rendered on browser.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using 'jimu/BaseWidget' hence, i think no need to mention "_&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;WidgetBase, _TemplatedMixin" &lt;/SPAN&gt;again in my custom widget.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when I instantiate this custom widget using the method you specified above, I am unable to leverage the advantages given by 'jimu/BaseWidget' and 'jimu's - WidgetManager' of JS Web AppBuilder (though my custom widget is extending 'jimu/BaseWidget' and just because the instance is not given by WidgetManager and our custom code).. such as..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. this.map is not available&lt;/P&gt;&lt;P&gt;2. Events mentioned in "Communication to app container" help document (&lt;A href="https://developers.arcgis.com/web-appbuilder/guide/communication-to-app-container.htm" title="https://developers.arcgis.com/web-appbuilder/guide/communication-to-app-container.htm"&gt;Communication to app container—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers&lt;/A&gt; )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please help me if there is any way which I can follow to get these functionalities for my custom widget also either with above approach of instantiating or by using WigetManager's functions. I tried identifying how Widget Manager is creating instances for widgets. But, I could not understand where the 'settings' object is being generated for the widget to which instance has to be generated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, what I am looking for is, a way to instantiate custom widget, which gives all the Web AppBuilder widgets functionalities mentioned above and ability to mention to which domNode the widget should be bound.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know if I am not clear anywhere.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Really I thank you very much for your kind help. Highly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With Regards,&lt;/P&gt;&lt;P&gt;Vara Prasad.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Mar 2016 04:46:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-instantiate-a-custom-widget-in-web/m-p/567874#M15177</guid>
      <dc:creator>Vara_PrasadM_S</dc:creator>
      <dc:date>2016-03-29T04:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to instantiate a custom widget in Web AppBuilder in javascript ?</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-instantiate-a-custom-widget-in-web/m-p/567875#M15178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Vara,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I have never developed a full WAB widget that is to be used and added inside another WAB widget. When I am building complex widget that need a support dijit (as I see in your case) then I create a dojo templated dijit (just like the WAB team does with the jimu dijits). If your support dijit need access to the map and communication to the app container then I just pass a instance of the parent widget that called the support dijit to get access to those objects (i.e. parentWidget.map).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Mar 2016 14:05:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-instantiate-a-custom-widget-in-web/m-p/567875#M15178</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2016-03-29T14:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to instantiate a custom widget in Web AppBuilder in javascript ?</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-instantiate-a-custom-widget-in-web/m-p/567876#M15179</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok.. Thanks Robert!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2016 10:50:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/how-to-instantiate-a-custom-widget-in-web/m-p/567876#M15179</guid>
      <dc:creator>Vara_PrasadM_S</dc:creator>
      <dc:date>2016-03-30T10:50:40Z</dc:date>
    </item>
  </channel>
</rss>

