<?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: Access widget config.json from a user-created js in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/access-widget-config-json-from-a-user-created-js/m-p/858832#M11645</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks again Robert. Worked.&lt;/P&gt;&lt;P&gt;the only thing is that if i have 100 parameters to pass, then I need to pass all of them as parameters in either the constructor or methods. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Jun 2016 19:31:02 GMT</pubDate>
    <dc:creator>Alexwang</dc:creator>
    <dc:date>2016-06-24T19:31:02Z</dc:date>
    <item>
      <title>Access widget config.json from a user-created js</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/access-widget-config-json-from-a-user-created-js/m-p/858830#M11643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can use this.config.&amp;lt;&amp;gt; to get any configurations in config.json from the Widget.js. But how can i access it from&amp;nbsp; a usercreated.js?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jun 2016 18:26:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/access-widget-config-json-from-a-user-created-js/m-p/858830#M11643</guid>
      <dc:creator>Alexwang</dc:creator>
      <dc:date>2016-06-24T18:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Access widget config.json from a user-created js</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/access-widget-config-json-from-a-user-created-js/m-p/858831#M11644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alex,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; If the &lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;usercreated.js is called from the widgets Widget.js then all you need to do is pass a reference to the widget into the js file in the js files constructor or use a public var in your js file and set it to "this".&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jun 2016 18:31:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/access-widget-config-json-from-a-user-created-js/m-p/858831#M11644</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2016-06-24T18:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: Access widget config.json from a user-created js</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/access-widget-config-json-from-a-user-created-js/m-p/858832#M11645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks again Robert. Worked.&lt;/P&gt;&lt;P&gt;the only thing is that if i have 100 parameters to pass, then I need to pass all of them as parameters in either the constructor or methods. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jun 2016 19:31:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/access-widget-config-json-from-a-user-created-js/m-p/858832#M11645</guid>
      <dc:creator>Alexwang</dc:creator>
      <dc:date>2016-06-24T19:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Access widget config.json from a user-created js</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/access-widget-config-json-from-a-user-created-js/m-p/858833#M11646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alex,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; NO absolutely not. Just pass the widget object (i.e. yourJS.parentWidget = this inside your Widget.js) and then you can use parentWidget.config.xyz in your js file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jun 2016 19:55:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/access-widget-config-json-from-a-user-created-js/m-p/858833#M11646</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2016-06-24T19:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: Access widget config.json from a user-created js</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/access-widget-config-json-from-a-user-created-js/m-p/858834#M11647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok, i think i was confused. &lt;/P&gt;&lt;P&gt;currently I can make it work like below. can you please share your codes so i can access all parameters in the config.json within User.js?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in config.json&lt;/P&gt;&lt;P&gt;"xyz": "USA", &lt;/P&gt;&lt;P&gt;"abc": "Canada"&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in Widget.js&lt;/P&gt;&lt;P&gt;constructor: function (options) {&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; ......&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; this.UserJS = UserJS.getInstance(options.config.xyz);&lt;/P&gt;&lt;P&gt; },&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in User.js&lt;/P&gt;&lt;P&gt;clazz.getInstance = function (xyz) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (instance === null) {&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; instance = new clazz();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; instance.xyz = xyz;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return instance;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so within User.js, console.log(this.xyz) will return "USA"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jun 2016 20:26:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/access-widget-config-json-from-a-user-created-js/m-p/858834#M11647</guid>
      <dc:creator>Alexwang</dc:creator>
      <dc:date>2016-06-24T20:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: Access widget config.json from a user-created js</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/access-widget-config-json-from-a-user-created-js/m-p/858835#M11648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alex,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; In Widget.js you would create a new instance of your User.js i.e&lt;/P&gt;&lt;P&gt;var user = new User();&lt;/P&gt;&lt;P&gt;user.parentWidget = this;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and in the User.js you would have a public var like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;return declare([_WidgetBase, Evented], {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parentWidget: null;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The you use this.parentWidget.config.xyz as this.parentWidget a reference to the Widget.js.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jun 2016 20:39:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/access-widget-config-json-from-a-user-created-js/m-p/858835#M11648</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2016-06-24T20:39:04Z</dc:date>
    </item>
  </channel>
</rss>

