Topic: Change income data for MULTISELECT
lgmaxim31 free asked 3 years ago
*Expected behavior*i want to use an object with TITLE and ID
return {
countries: [
{ title: 'USA', id: 1 },
{ title: 'Germany', id: 2 },
{ title: 'France', id: 3 },
{ title: 'Poland', id: 4 },
{ title: 'Japan', id: 5 }
]
};
*Actual behavior*Actualy you propose to use an object with TEXT and VALUES
return {
countries: [
{ text: 'USA', value: 1 },
{ text: 'Germany', value: 2 },
{ text: 'France', value: 3 },
{ text: 'Poland', value: 4 },
{ text: 'Japan', value: 5 }
]
};
Resources (screenshots, code snippets etc.)
Can you tell me how to change it ???
Mikołaj Smoleński staff answered 2 years ago
Hello @lgmaxim31,
I suggest to use computed
property to parse Your countries array:
computed: {
parsedCountries() {
return this.countries.map((country) => {
return {
text: country.title,
value: country.id
};
})
}
}
Then just use parsedCountries
in Select component.
Keep coding, Mikołaj from MDB
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Free
- Premium support: No
- Technology: MDB Vue
- MDB Version: MDB4 6.7.3
- Device: ALL
- Browser: ALL
- OS: ALL
- Provided sample code: No
- Provided link: No