dmx.requestUpdate(); calls will need updating in AC2

If you have previously used

dmx.requestUpdate();

you will need to make changes with AC2.

this.dmxComponent._updateValue();
this.dmxComponent.dispatchEvent('updated');

My use case was a Select2 binding:

<select data-cy="tag_search" dmx-bind:options="tenant_tags.data" optiontext="text" optionvalue="text" id="recipes_tag_select" class="select2 " name="tags[]" multiple="multiple" dmx-on:updated="run({run:{action:`recipes.load({},true)`}})">
</select>

I previously used:

$('#recipes_tag_select').select2({
            
            allowClear: true,
            placeholder: " <%=_('translations.type_or_select_tags')%>",
        }).on('change.select2', function (e) {
           
            dmx.requestUpdate();
        });

which no longer triggers an update on the element

Patrick gave me the following that works with AC2

$('#recipes_tag_select').select2({
            
            allowClear: true,
            placeholder: " <%=_('translations.type_or_select_tags')%>",
        }).on('change.select2', function (e) {
            
            this.dmxComponent._updateValue();
            this.dmxComponent.dispatchEvent('updated');
        });
3 Likes