Question:
I managed to create a repeater that shows from a collection that references another collection through code.
This was the code I built:
import wixData from 'wix-data';
$w.onReady(function () {
const resourceCollection = "MentalHealth";
const therapist = "ab849261-075c-4efd-856d-5dc43e129b0f";
const counsellor = "75466c39-13a9-43f0-beb3-95aefa28a39c";
wixData.query(resourceCollection)
.hasSome("category", [therapist, counsellor])
.find()
.then((results) => {
// console.log("Results", results);
$w("#repeaterCounThera").onItemReady(($item, itemData, index) => {
$item("#repeaterImage").src = itemData.image
$item("#businessName").text = itemData.title
$item("#description").text = itemData.description
})
$w("#repeaterCounThera").data = results.items;
})
.catch((err) => {
console.log(err);
});
I wonder what the dataset no code and dataset code route would involve?
When I tried the dataset no code, the filters I used share the same field within one dataset that the main dataset connects to.
Here are further notes on the dataset with no code scenario:
then tried to combine dataset with code but didn’t work. I only coded the sub-dataset that would then be used by the main dataset
$w("#myDataset").setFilter( wixData.filter()
.eq("category", "Therapist")
.eq("category", "Counsellor")
);
Product:
Wix classic editor