AnsweredAssumed Answered

Combobox in WAB basic custom widget

Question asked by crtspfe on Jun 13, 2017
Latest reply on Jun 13, 2017 by kenbuja

I am a beginner in ArcGIS WAB, I want to create a custom widget that calculates zonal stats and generates charts. This is the mockup of my my widget :

 

I just began coding and I got stuck on the comboboxes  

 

here is my code :

 

<input id="zoneSelect">
<p>
   <button onClick="alert(dijit.byId('zoneSelect').get('value'))">
      Get value
   </button>
</p>

 

define(['dojo/_base/declare', 'jimu/BaseWidget', "dojo/store/Memory", "dijit/form/ComboBox", "dojo/domReady!"],
function (declare, BaseWidget, Memory, ComboBox) {
//To create a widget, you need to derive from BaseWidget.
return declare([BaseWidget], {
// Custom widget code goes here
baseClass: 'jimu-widget-statistiqueszonales',
startup: function () {
this.inherited(arguments);
this.mapIdNode.innerHTML = 'map id:' + this.map.id;
this.zone = new Memory({
data: [
{ nom: "Commune", id: "Com" },
{ nom: "Province", id: "Prv" },
{ nom: "Région", id: "Reg" }
]
});
this.cmbZone = new ComboBox({
id: "zoneSelect",
name: "zone",
value: "Commune",
store: zone,
searchAttr: "nom"
}, "zoneSelect").startup();
}
});
});

Outcomes