Hi, I created a filter to search for professional information based on some conditions but it's not working. This is the code:
// For full API documentation, including code examples, visit http://wix.to/94BuAAs import wixData from 'wix-data'; export function search_click(event, items) { $w("#dataset1").setFilter(wixData.filter() .contains("serviceType", $w("#servicetype").value) .contains("profession", $w("#profession").value) .contains("location", $w("#location").value)) .then(results => { console.log("Dataset is now filtered"); $w("#repeater1").data = results.items; }).catch(error => { console.log(error); }) $w("#repeater1").expand(); }
This is the site url: https://elliosedgeservice.wixsite.com/mysite
Do you mean the element ID because the referenced collection contains several items with each item having their own ID and I'm trying to filter from all the contents of the collection. Could you please explain better as I'm a novice in coding. Thanks
Thanks, I've done it but I still have the same issue. It's the professional page.
If the Repeater is connected to the Dataset, then you should not set the Repeater's .data property to the results of the filter. However, the .then() function would be the correct place to .expand() the Repeater:
import wixData from 'wix-data'; export function search_click(event, items) { $w("#dataset1").setFilter(wixData.filter() .contains("serviceType", $w("#servicetype").value) .contains("profession", $w("#profession").value) .contains("location", $w("#location").value)) .then(results => { console.log("Dataset is now filtered"); // don't need this: $w("#repeater1").data = results.items; $w("#repeater1").expand(); }).catch(error => { console.log(error); }) }
If you are still having problems with this, on what page are you having the problem?