I have well partially successfully allowed the search on my database by searching a fieldKeys that are referenced in the main collection. I used one dataset to filter another to achieve this. I also had to manually add about 30 items as you cant search more than 1000 rows without doing a skip and it isnt recccommended anyway.
Problem is after it narrows down the search the first dropdown has to be changed to a different item before it allows me to reuse the old item.
Say i was searching for cockatoos in the first “families” dropdown and then i wanted to search on a different species of cockatoo after looking at the cockatiel you cant select the cockatoo again you have to change to say kingfishers and then change back to cokatoos again.
I am open to alternatives if i am doing it the hard way?
here is the code below
// For full API documentation, including code examples, visit http://wix.to/94BuAAs
import wixData from ‘wix-data’;
//Set dataset to “Default”
$w.onReady( function () {
$w(“#pageSpeciesData”).setFilter(wixData.filter()
.eq(“familyCommonName”, “Default”)
)
.then(() => {
console.log(“Dataset is now Default Family filtered”);
})
. catch ((err) => {
console.log(err);
});
});
//family
export function dropdownFamily_change(event) {
$w("#pageSpeciesData").setSort(wixData.sort()
.ascending("taxonName")
);
$w("#pageSpeciesData").setFilter(wixData.filter()
.eq("familyCommonName", $w("#dropdownFamily").value)
)
.then(() => {
console.log("Dataset is now Family filtered");
})
. **catch** ((err) => {
console.log(err);
});
}
//Species
export function dropdownSpecies_change(event) {
//Add your code for this event here:
$w("#pageSpeciesData").setFilter(wixData.filter()
.eq("taxonName", $w("#dropdownSpecies").value)
)
.then(() => {
console.log("Dataset is now Species filtered");
})
. **catch** ((err) => {
console.log(err);
});
}