Hey Guys
I have built a dropdown that is linked to a dataset.
I would like the dropdown to show a certain field (player name) and the value to be another (player ID)
This is relatively trivial if you set the items manually - however when they are set via a dataset I don’t see an option to do it (see image below)
Am I missing something? is there a way to do it?
Thanks so much
Kobi
Hi kobifrankental,
You have a point, we do not have this option and should add it.
What you can do for now, is to use wix-data APIs and the dopdown APIs to get the list of players from the collection to the dropdown. Something like
Should be something like the following
import wixData from 'wix-data';
$w.onReady(() => {
wixData.query('PLAYERS')
.find()
.then(res => {
let options = res.items.map(player =>
{label: player.playerName, value: playerId});
$w('#DROPDOWN').options = options;
});
})