Hi,
I have a collection of 'Owners' and I have a collection of 'Listings'. So each listing is connected to an owner. Some owners may have many listings. In the owners collection, one of the fields is 'location'.
I have a category page that displays all listings in a repeater. I want users to be able to search the listings using a dropdown based on the owner of that listing's location.
So if the code for the filter is:
$w("#listings").setFilter( wixData.filter()
.contains("propertyname", $w('#locationDropdown').value))
How do I make the propertyname = the location of the listing's owner?
I've searched the forums and I can't work out whether this is possible or not? Is the only option to add the owner's location as a field in the listing? This seems like it would be time consuming and very open to human error.
@givemeawhisky Thanks for replying. All those articles explain how to display filtered data using reference fields - but that's not my issue. I'm wanting users to be able to use a dropdown to filter the results in a repeater based on information in a referenced collection.
export function locationDropdown_change(event) {
$w("#listings").setFilter( wixData.filter()
.contains("propertyname", $w('#locationDropdown').value))}
So if this is the code for the dropdown - how do I make the propertyname = the location of the listing's owner?
https://support.wix.com/en/article/displaying-content-from-multiple-database-collections-using-datasets https://support.wix.com/en/article/about-displaying-content-from-multiple-database-collections-using-datasets
https://support.wix.com/en/article/about-connecting-multiple-database-collections
https://support.wix.com/en/article/about-reference-fields-in-database-collections
https://support.wix.com/en/article/displaying-content-from-multiple-database-collections-using-reference-fields-4034931
the last link is probably the best one for you.