AnsweredAssumed Answered

Unable to dinamically add option to dojo FilteringSelect

Question asked by sit_aimag on Aug 18, 2017
Latest reply on Aug 20, 2017 by sit_aimag

Hi,

I am very new to dojo and I am stuck on this issue. When I try to add a new option, the error "addOption is not a function" arises. This is my code:

Widget.js:

function(
declare,
BaseWidget,
Button,
_TemplatedMixin,
_WidgetsInTemplateMixin,
FilteringSelect,
on,
keys,
Parser,
Memory,
array,
lang,
map,
FeatureSet,
Query,
QueryTask
) {

return declare([BaseWidget, _TemplatedMixin, _WidgetsInTemplateMixin], {

   name: 'Cerca via',
   baseClass: 'jimu-widget-CercaVia',
    query: null,
    queryTask: null,

    postCreate: function() {
    console.log("postCreate!");
    var mapFrame = this;
    this.inherited(arguments);

    this.ComuniSelect.addOption({disabled:false,label:'label',selected:true,value:1});
},

Widget.html:

 

Can someone point me in the right direction?

Bonus question: I would like to add to the FilteringSelect the option to search in the middle of the options. I read that this is possible setting queryExpr to "*$0*". How do I put it into my code?

 

Thanks,

Marco

Outcomes