Prem Kumar
Prem Kumar

Reputation: 51

React Material-UI Autocomplete: How to clear multiple values (mui chips) selected in a Autocomplete field on changing the value in another field?

How to clear the mui-chips in Material UI Autocomplete TextField on changing the value in another field. In the below example, I am trying to clear subtype value whenever Type value is getting changed. I am able to update the drop-down options based on value changed in the Type field. But the mui chips are not getting cleared.

options for Banking Type

In the below screenshot, I am trying to clear the options and mui-chips for the subtype field. Only the Options are getting updated, but mui-chips are not getting cleared.

mui chips not gettig reset, on changing Type drop-down value

Issue reproducible in below codesandbox link: https://codesandbox.io/s/autocomplete-multiple-wkumx

Upvotes: 2

Views: 7615

Answers (1)

Prem Kumar
Prem Kumar

Reputation: 51

Got the answer from oliviertassinari from github.

Working solution is available at below link: https://codesandbox.io/s/autocomplete-multiple-forked-onu5n?file=/src/demo.js:0-2437

Upvotes: 3

Related Questions