udos86 / ng-dynamic-forms

Rapid form development library for Angular
ISC License
1.32k stars 369 forks source link

Bug when disabling dropdown item #1181

Open VisionSystemDev opened 10 months ago

VisionSystemDev commented 10 months ago

I'm submitting a


[x] Bug / Regression
[ ] Feature Request / Proposal

I'm using


NG Dynamic Forms Version: `18.0.0`

[ ] Basic UI
[ ] Bootstrap UI  
[ ] Foundation UI
[ ] Ionic UI
[ ] Material  
[ ] NG Bootstrap
[x] Prime NG

Description

In my application, when selecting an item from the drop-down list, it disables this option, it was working normally in version 15. After the update, the item is selected normally, however it does not show the item in the dynamic component, but in the formGroup the value is assigned.

I tested it with the p-dropdown component of primeng and it works, only when the dynamic component v18.0.0 is used does the error happen

How to disable formArrayModel item


this.formArrayModel.groups.forEach((group) => {
        const dropdown = group.group[0] as any;

        dropdown.options.forEach((option) => {
          if (
            !option.value?.nomeChave ||
            this.containsOption(option.value?.nomeChave)
          ) {
            option.disabled = true;
          } else {
            option.disabled = false;
          }
        });
});

image