Topic: Bug mdb-select when array goes empty

digitalmanagerguru free asked 3 years ago


Hi there,

I saw a problem with mdb select component.

Let say I've 2 selects. Both populated from an API. Where the 1st select is populated first, and the 2nd select is only populated after the 1st select choice. Since it will need the id of the 1st select to make a axios.get with that id. I am able to populate the fields without a problem. And when selecting 1st select, the 2nd is populated correctly. The problem is when I select an option on the 1st select, then I select an option on the 2nd select, and after that I decide to change the 1st select again. When I do this, it will make another axios.get and retreive another array of objects, but let say the array I got is empty. What happens is that the 2nd select still shows the old data and the last selected value and it does not removes the selection.

I've debug the problem and found out that the problem comes from the validate() function.The last if of that function should be imo:

if (this.customValidation) {
      if (this.isValid) {
        this.valid = true;
      } else {
        this.valid = false;
      }
      this.wasValidated = true;
    }
    else {
      this.wasValidated = false;
    }

instead of:

if (this.customValidation) {
      if (this.isValid) {
        this.valid = true;
      } else {
        this.valid = false;
      }
      this.wasValidated = true;
    }

I've only added:

    else {
      this.wasValidated = false;
    }

Best regards


Magdalena Dembna staff answered 3 years ago


Thank you for this bug report, it's very helpful for us - we will certainly take care of this issue in the future. Best regards, Magdalena



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Vue
  • MDB Version: 6.7.1
  • Device: Desktop
  • Browser: Chrome
  • OS: Win.10
  • Provided sample code: No
  • Provided link: No