AnsweredAssumed Answered

How to remove select option using Javascript

Question asked by Harald Kampen on Jul 21, 2016
Latest reply on Jul 22, 2016 by Harald Kampen

We have a select field and the available options are depending: in edit view I use all, in create view they must be filtered.

 

I tried different ways but nothing works. For example to filter the list before rendering. I have no idea to access the list.

 

({ extendsFrom: 'CreateActionsView',

    initialize: function (options) {      

        this._super('initialize', [options]);    

        this._filterRtQueue();

    },

    _filterRtQueue : function() {

        //TODO remove some entries from select list

        //console.info(this.app.metadata.getStrings('rt_queue_list'));     

    }  

});

 

Or after rendering. I can't manipulate the HTML this way, the result is undefined:

({ extendsFrom: 'CreateActionsView',

    initialize: function (options) {       

        this._super('initialize', [options]);     

        //this._filterRtQueue();

    },

    _filterRtQueue : function() {

        console.log(this.$('.select2-result'));

    },

   

    _render : function() {

        this._super("_render");

        this._filterRtQueue();

    } 

});

 

Any idea?

Outcomes