AnsweredAssumed Answered

Getting error when using: 'dijit/form/ComboBox' and 'dojo/dom-construct'

Question asked by warleymendes@gmail.com on Jan 23, 2018
Latest reply on Jan 23, 2018 by warleymendes@gmail.com

Hi Guys,

I'm trying to insert values in a ComboBox using domConstruct.create.
When I select a city (cbxMunicipio) the regins ComboBox (cbxBairro) needs to be filled.

 

But I'm getting error in the follow line:
domConstruct.create("option", { value: "111", innerHTML: "test" }, cbxB);

 

My Code:

 

Widget.html:

<div>
Municipio:
<select data-dojo-attach-point="cbxMunicipio" data-dojo-type="dijit/form/ComboBox"

   style="width:200px;" value="Selecione...">
   <option value="4000">Vitoria</option>
   <option value="3500">Serra</option>
</select>

Bairro:
<select data-dojo-attach-point="cbxBairro" data-dojo-type="dijit/form/ComboBox" style="width:200px;">
</select>


</div>

 

Widget.js

define([
'dojo/_base/declare',
'jimu/BaseWidget',
'dijit/_WidgetsInTemplateMixin',
'dijit/form/ComboBox',
'dojo/_base/lang',
'dojo/dom-construct',
'dojo/dom',
'dojo/on',
'dojo/domReady!'
],
function(
declare,
BaseWidget,
_WidgetsInTemplateMixin,
ComboBox,
lang,
domConstruct,
dom,
on
) {
return declare([BaseWidget, _WidgetsInTemplateMixin], {

baseClass: 'jimu-widget-customwidget',

startup: function() {
   this.inherited(arguments);
   console.log('startup');
},

onOpen: function(){
   on(this.cbxMunicipio, "change", lang.hitch(this, this._getMunicipioChange));
},

_getMunicipioChange: function(evt){

   var cbxB = domConstruct.create(this.cbxBairro);

   domConstruct.create("option", { value: "111", innerHTML: "test" }, cbxB);

   console.log('OK....');
}

});
});

 

Someone have any idea what I'm doing wrong?

 

Thanks,

Warley

Outcomes