AnsweredAssumed Answered

How to update options after sync in Javascript?

Question asked by Harald Kampen on Jun 4, 2020
Latest reply on Jun 4, 2020 by Harald Kampen

Hi,

we have a multiselect with some deprecated values. The deprecated values should be removed if not in saved values. This is what I tried in the module record..js:

    _filterLocations: function()
    {
          var location_c = this.model.get('location_c'), skipList = ['dus6.2'], i = 0;

          if (typeof location_c != 'undefined') {
              var list = app.lang.getAppListStrings('data_center_list');
             Object.keys(list).forEach(function(key) {
                  for (i in skipList) {
                       if (key == skipList[i] && ! location_c.includes(key)) {
                            delete list[key]
                       }
                  }
             })
             this.model.fields['location_c'].options = list   
          }
    }

The function is called by sync: this.model.once('sync', this._filterLocations, this)  

With console.log(list) is 'dus6.2' removed, but not in the page view.

How can I update / re-render the select values?

 

We are using SugarCRM 7.9

Regards

Harald

Outcomes