AnsweredAssumed Answered

Update fields dropdown when layers dropdown is changed

Question asked by gisp on May 2, 2017
Latest reply on May 3, 2017 by gisp

Newbie question here.


I have a LayerChooserFromMapWithDropbox added to my widget.


I am trying to make the "selection-change" event to work so that when a layer is changed, a dijit/form/Select box gets updated with fields from the selected layer.


This should be pretty simple but my limited experience is making this take longer than it should.


This is what I have so far...


      postCreate: function() {
        var layerChooser = new LayerChooserFromMap({
        _layerChooserDropBox = new LayerChooserFromMapWithDropbox({
        }, this.layerChooserDropBoxDiv);
        on(_layerChooserDropBox, "selection-change", lang.hitch(this, function(){

          if (_layerChooserDropBox.getSelectedItem()){
            _layerObject = _layerChooserDropBox.getSelectedItem().layerInfo.layerObject;
            array.forEach(_layerObject.fields, lang.hitch(this, function(fldObj){
              // update fieldSelectDiv