Hello everyone,
I have an issue when displaying data from a collection into a table using drop downs.
The first drop down function is working but the second not:
Thank you in advance !
import wixData from "wix-data"
export function searchbutton_click(event)
{ //Add your code for this event here:
// Runs a query on the "recipes" collection wixData.query("FindPartner")
// Query the collection for any items whose "Name" field contains
// the value the user entered in the input element
.contains("fullNameOrUsername", $w("#searchBox").value)
.find() // Run the query
.then(res => {
// Set the table data to be the results of the query
$w("#table").rows = res.items;
}); }
export function dropdown1_change(event) {
//Add your code for this event here:
// Runs a query on the "recipes" collection
wixData.query("FindPartner")
// Query the collection for any items whose "Name" field contains
// the value the user selected in the dropdown
.contains("activity", $w("#dropdown1").value)
.find() // Run the query .then(res => {
// Set the table data to be the results of the query
$w("#table").rows = res.items
});}
export function dropdown2_change(event) {
//Add your code for this event here:
// Runs a query on the "recipes" collection
wixData.query("FindPartner")
// Query the collection for any items whose "Name" field contains
// the value the user selected in the dropdown
.contains("lookingForA", $w("#dropdown2").value)
.find() // Run the query
.then(res => {
// Set the table data to be the results of the query
$w("#table").rows = res.items
});}
Hey there
What do you mean by not working? Does it not filter the table at all or does it filter the table with the wrong items?
If the second drop down code alter your code and make sure the below is in your page and run it.
.then(res => { console.log("------DEBUGGER INFO-----"); console.log(res.items); console.log("------DEBUGGER INFO-----"); $w("#table").rows = res.items });}
Look in your developer console for errors or output as the above code should output any hits from the query. If you don't get any output in the res.items in the developer console the query it self does not return any records and that is the reason it does not work.