I’m trying to build a Wix site for an event for my non-profit organisation. I used the video tutorial by WIX to build up the code for searching and sorting a name list via Drop-down box.
Search Works Fine!
Dropdown works but it has multiple entries of the categories, I really would appreciate your help!
Below is my code:
import wixData from ‘wix-data’ ;
@anthonyb Thank you for the immediate response! But I’m not a programmer, I would need some guidance on how to alter the code I have which could eliminate the duplicates.
A little trial and error based on the distinct function documentation was what I assumed or hoped that you would do, but alas this is a brand new world to you …
@jonatandor35
Interesting solution. I often see you using this map-command, seems to be something universal, what can be used in many cases. I should take a look at this.
@russian-dima yes.
The JS map() method is very useful.
you can always use the .forEach() method instead, but it’s longer and also considered to be slower.
P.S if you use .forEach() it’d be something like:
let options = [];
r.items.forEach((e, index) => {options[index] = {label: e, value:e}});