<?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 dynamic drop down of feature fields in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/dynamic-drop-down-of-feature-fields/m-p/1038638#M14455</link>
    <description>&lt;P&gt;in Web AppBuilder using JavaScript I have been trying to create a drop down list&amp;nbsp; of the fields for a feature brought in through url. I have been coming up with problem at every stage, I even had problem getting just the field name - which I finally got This works great:&amp;nbsp;&lt;/P&gt;&lt;P&gt;var layerUrl = this.config.facilitiesURL;&lt;BR /&gt;var layerInfoRequest = esri.request({&lt;BR /&gt;&amp;nbsp; &amp;nbsp;url: layerUrl,&lt;BR /&gt;&amp;nbsp; &amp;nbsp;content: { f: "json" },&lt;BR /&gt;&amp;nbsp; &amp;nbsp;handleAs: "json",&lt;BR /&gt;&amp;nbsp; &amp;nbsp;callbackParamName: "callback"&lt;BR /&gt;});&lt;BR /&gt;layerInfoRequest.then(function (response) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp;fieldInfos = array.map(response.fields, function (aField) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;return {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; fieldName: aField.name&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //visible: true&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; };&lt;BR /&gt;&amp;nbsp;});&lt;/P&gt;&lt;P&gt;for (i = 0; i &amp;lt; fieldInfos.length; i++) {&lt;BR /&gt;console.log(fieldInfos[i]);&lt;BR /&gt;}&lt;BR /&gt;console.log("fieldInfos", fieldInfos[Object.keys(fieldInfos)[0]]); //obj[Object.keys(obj)[0]];&lt;BR /&gt;}, function (error) {&lt;BR /&gt;console.log("Error: ", error.message);&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;------------------------------------------------------&lt;/P&gt;&lt;P&gt;Now trying to fill the drop down I cannot seem to get, everything I have tried has failed this is the basic I have tried the part I am not showing is the html that points to the drop down on the configuration menu. I need help I have been working on this for a week now. I admit I am not a solid JavaScript widget developer.&lt;/P&gt;&lt;P&gt;var store = new Memory({&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// IF I USE THIS AS THE STORE VARIABLE IT WORKS FINE&lt;BR /&gt;data: [&lt;BR /&gt;{ id: "foo", label: "Foo" },&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// BUT IF I USE THE fieldInfos WHICH IS THE VARIABLE OF THE FIELDS&amp;nbsp;&lt;BR /&gt;{ id: "bar", label: "Bar" }&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DEFINED ABOVE I GET THE ERROR:&amp;nbsp;TypeError: Cannot read property 'get' of&amp;nbsp;&lt;BR /&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;undefined.&amp;nbsp; &amp;nbsp; I HAVE VARIABLE fieldInfos OUTSIDE OF THE BRACKETS&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;var store = fieldInfos;&lt;BR /&gt;var os = new ObjectStore({ objectStore: store });&lt;/P&gt;&lt;P&gt;var s = new Select({&lt;BR /&gt;name: "test",&lt;BR /&gt;store: os&lt;BR /&gt;}, "ABCTest");&lt;BR /&gt;s.startup();&lt;/P&gt;&lt;P&gt;s.on("change", function () {&lt;BR /&gt;console.log("my value: ", this.get("value"))&lt;BR /&gt;});&lt;/P&gt;</description>
    <pubDate>Fri, 19 Mar 2021 13:55:35 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-03-19T13:55:35Z</dc:date>
    <item>
      <title>dynamic drop down of feature fields</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/dynamic-drop-down-of-feature-fields/m-p/1038638#M14455</link>
      <description>&lt;P&gt;in Web AppBuilder using JavaScript I have been trying to create a drop down list&amp;nbsp; of the fields for a feature brought in through url. I have been coming up with problem at every stage, I even had problem getting just the field name - which I finally got This works great:&amp;nbsp;&lt;/P&gt;&lt;P&gt;var layerUrl = this.config.facilitiesURL;&lt;BR /&gt;var layerInfoRequest = esri.request({&lt;BR /&gt;&amp;nbsp; &amp;nbsp;url: layerUrl,&lt;BR /&gt;&amp;nbsp; &amp;nbsp;content: { f: "json" },&lt;BR /&gt;&amp;nbsp; &amp;nbsp;handleAs: "json",&lt;BR /&gt;&amp;nbsp; &amp;nbsp;callbackParamName: "callback"&lt;BR /&gt;});&lt;BR /&gt;layerInfoRequest.then(function (response) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp;fieldInfos = array.map(response.fields, function (aField) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;return {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; fieldName: aField.name&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; //visible: true&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; };&lt;BR /&gt;&amp;nbsp;});&lt;/P&gt;&lt;P&gt;for (i = 0; i &amp;lt; fieldInfos.length; i++) {&lt;BR /&gt;console.log(fieldInfos[i]);&lt;BR /&gt;}&lt;BR /&gt;console.log("fieldInfos", fieldInfos[Object.keys(fieldInfos)[0]]); //obj[Object.keys(obj)[0]];&lt;BR /&gt;}, function (error) {&lt;BR /&gt;console.log("Error: ", error.message);&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;------------------------------------------------------&lt;/P&gt;&lt;P&gt;Now trying to fill the drop down I cannot seem to get, everything I have tried has failed this is the basic I have tried the part I am not showing is the html that points to the drop down on the configuration menu. I need help I have been working on this for a week now. I admit I am not a solid JavaScript widget developer.&lt;/P&gt;&lt;P&gt;var store = new Memory({&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// IF I USE THIS AS THE STORE VARIABLE IT WORKS FINE&lt;BR /&gt;data: [&lt;BR /&gt;{ id: "foo", label: "Foo" },&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// BUT IF I USE THE fieldInfos WHICH IS THE VARIABLE OF THE FIELDS&amp;nbsp;&lt;BR /&gt;{ id: "bar", label: "Bar" }&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DEFINED ABOVE I GET THE ERROR:&amp;nbsp;TypeError: Cannot read property 'get' of&amp;nbsp;&lt;BR /&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;undefined.&amp;nbsp; &amp;nbsp; I HAVE VARIABLE fieldInfos OUTSIDE OF THE BRACKETS&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;var store = fieldInfos;&lt;BR /&gt;var os = new ObjectStore({ objectStore: store });&lt;/P&gt;&lt;P&gt;var s = new Select({&lt;BR /&gt;name: "test",&lt;BR /&gt;store: os&lt;BR /&gt;}, "ABCTest");&lt;BR /&gt;s.startup();&lt;/P&gt;&lt;P&gt;s.on("change", function () {&lt;BR /&gt;console.log("my value: ", this.get("value"))&lt;BR /&gt;});&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 13:55:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/dynamic-drop-down-of-feature-fields/m-p/1038638#M14455</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-03-19T13:55:35Z</dc:date>
    </item>
  </channel>
</rss>

