HI i stucked again with one problem. There is many dropdowns on forum but i need dropdown which takes values from query i made. I have reapetor with chairs and want to put names of people to this chairs and on change save it. But when i sit someone i dont want to see him again in dropdown. So i have query to give me not sitted persons. But query gives me many results with many columns. I would like only “imie” in dropdown. I will write when i manage to solve it entire code because i couldnt find code for such dropdown which gives me not unique values but not “used” values. I was trying to many codes from forum but alweys something was wrong.
My funncion give such results
getnotSitted()
.then(results => {
console.log(results);
0:
“{"_id":"743cc88e-0789-4eb9-91ea-52d1a32ac02e","miejsce":103,"_owner":"5c4794ca-8ac7-4193-9e61-6bf81eb53307","_createdDate":"2018-12-05T16:54:20.584Z","_updatedDate":"2018-12-05T18:40:19.744Z","imie":"aga zielska"}”
my code i tried is like here but nothing shows up in dropdown
$w.onReady( function () {
uniqueDropDown1();
})
function uniqueDropDown1 (){
getEmptyRooms()
.then(results => {
//console.log(results)
//console.log (“rrrrrrrrrrrrrrrrrrrrrrrrrrrrrr”)
const uniqueTitles = getUniqueTitles(results.items);
$w("#dropdown").options = buildOptions(uniqueTitles);
});
function getUniqueTitles(items) {
const titlesOnly = items.map(item => item.imie);
return [… new Set(titlesOnly)];
}
function buildOptions(uniqueList) {
return uniqueList.map(curr => {
return {label:curr, value:curr};
});
}
}