Topic: Autocomplete question
                  
                  EXPERTiCO
                  free
                  asked 3 years ago
                
Hi. I want to use autocomplete component in MDB 5 Vue But I have a questions:
How to handle selected item?
<MDBAutocomplete
  v-model="cityAutocompleteAsync"
  :filter="cityAutocompleteFilterAsync"
  :displayValue="cityAutocompleteDisplayValueAsync"
  style="width: 22rem"
  :label="$t('dictionary.city')"
  @itemSelect="cityAutocompleteSelect(e)"
  @clear="cityAutocompleteClear"
  clearButton
/>
cityAutocompleteSelect:function(e){
      alert(e);
  },
But alert shows me undefined
How to set default selected value?
How to add clear button and handle clear event?
                      
                      EXPERTiCO
                      free
                        answered 3 years ago
                    
I just rewrote this component for me. Added validation and property for selected objectIf needed, please use my approach
* Removed content *
Mikołaj Smoleński staff commented 3 years ago
Thank you for posting your solution, but it's a pro component and we can't leave the code here.
Keep coding, Mikołaj from MDB
EXPERTiCO free commented 3 years ago
sorry about that
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- ForumUser: Free
 - Premium support: No
 - Technology: MDB Vue
 - MDB Version: MDB5 1.9.0
 - Device: Any
 - Browser: Any
 - OS: Any
 - Provided sample code: No
 - Provided link: No
 
Mikołaj Smoleński staff commented 3 years ago
I suggest to watch cityAutcompleteSync value changes, because it observe item selecting. Here's the snippet example: https://mdbootstrap.com/snippets/vue/mikolaj-smolenski/3721065
Keep coding, Mikołaj from MDB
EXPERTiCO free commented 3 years ago
@Mikołaj Smoleński thank you. But it is not that I mean. I want to get whole selected object. City object is {id:1, name:'City name'}. I want to get id of selected object