i’ve included a user input filter (with code) so that users can filter the properties by location/region.
unfortunately each time a region is selected the original filter which shows the property type for the page disappears and the filter shows all types. So instead of showing only the hotels in the list it shows all from the list.
Here is the code used
…
import wixData from ‘wix-data’;
Hi Shan
Thanks for the reply really appreciate the help.
I tried this but there was no data showing at all. So it didnt work
type is the field that shows either hotels or luxury villas (its a reference field - is that an issue)
What should I use for “Hard Coded Value”
.eq(“type”, “Hard Coded Value”)
@ruckshani Replace “Hard Coded Value” with the ID of the referenced item. In your case go to your “referenced” database and find the id of HOTELS or LUXURY VILLAS / TENTS .
To get the ID of either HOTELS or LUXURY VILLAS /TENTS go to their database and click on ‘Visible Fields’ and check ID
After that copy the ID of the item which will look like this
Your final code should be something like:
export function filterbyregion_change(event) {
let regionValue = $w("#filterbyregion").value;
$w("#dataset1").setFilter(wixData.filter()
.eq("region", regionValue)
.eq("type", "dc2a617c-17d0-4dfb-b49f-621882c4e42b") //this
);
}
Also this is a dynamic page it links from the AccommodationType dataset which holds these IDs. Data is populated in the repeater from Accommodation dataset where the property lists are. Do i need to create two separate pages instead of a dynamic page for this to work?