Hey,
I have a data set with a few fields (Monday, Tuesday, Wednesday) that have entries in each. Now when I connect the dropdown to show me a list of any of the fields, it is easy, just go and choose one of these options to show its entries in a list.
However, is there a way in which I do not connect it to the field directly, and instead it connects to either of the fields depending on anything else? Say today’s day? For example, if today is Tuesday, it connects to Tuesday and shows its entries, if Wednesday, it connects to Wednesday and shows its entries. Not just fixed on Monday. Any help?
Thanks
Hi haihac1157 6,
You can connect the dropdown options to a dataset and set the dataset filter to show only options of the given day. For example, it will look like the following -
$w('#DATASET').setFilter(wixData.filter().eq('day_of_week', 'Tuesday'));
I have already used that to filter the dataset to match the id of the dynamicdataset, now the there are items that have different times in the field “Monday” but for the same item (that has similar id from the other database.
This works when I manually link the dropdown list to the field “Monday” after the filter is applied. But how can I make it change , and not keep it just fixed on Monday?
Basically how can I set the values of the dropdown for different fields for the same item?
Say an item with a field “Name”, and three fields “Monday”, “Tuesday”, “Wednesday”. Now that item exists a few times in the list because it is taking many values for each field. so it is take 3 pm, 4 pm, 5 pm for Monday, and so the same item is repeated for these values with the same id from a different dataset.
Manually as you suggested, I can connect the dropdown to the dataset, and connect its values to always show me “Monday” for example, or any other field. But it will be fixed on Monday. How can I change it to switch to connect to another field with code?
I am already filtering the dataset to show only that id, so now I have only the same name, multiple times for the different times on Monday, Tuesday, and Wednesday. But how can I connect the dropdown to these fields with code so it can keep changing and not just fixed to one field?
Thank you