Is it possible to use a CheckboxGroup as a filter using the value within it? I would like to know if possible?
top of page
Important forum update
This forum is migrating to one unified Wix community forum starting July 26th, and will be read-only during the process.
Wishlist Page is the official platform for requesting new features. You can vote, comment, and track the status of the requested features.
bottom of page
My website is a tutoring website and my tutors select their subjects via a checkbox group, their choices are then stored in a database. See the figure below to see how their data is collected.
I then have a dynamic page with a repeater that shows a preview profile for each of my tutors. I want to filter that repeater/dataset by the same input seen above. So that a client can come on and select what subjects they would like and the repeater will filter accordingly. The image below is how my database is set up.
Notice it is categorised by subject. I have tried a lot of different methods, but have run into a lot of issues when trying to compare two arrays to each other. What I have currently can be seen below, I am only trying to filter by one subject currently, but it is just filtering everything out.
import wixData from "wix-data";
export function math_change(event){
console.log(event["target"]["id"])
let subject = event["target"]["id"];
let values = event["target"]["value"];
console.log(values)
filter(subject,values)
//let chosen = $w()
}
function filter(subject, values){
var qry = wixData.query("Team") // initialise query
$w('#teamDataset').setFilter(
wixData.filter()
.hasSome(subject, values)
)
.catch((err) => {
console.log("error: " + err)
})
Sorry it is not formatted properly I tried to paste it into a code snippet but it put it in the above form.
Any help would be greatly appreciated :)
It is possible. It's like filtering using other user input elements like dropdowns etc..
And the values are in array. See here:
https://www.wix.com/corvid/reference/$w.CheckboxGroup.html#value