This is my code:
import {wixData} from 'wix-data';
export function button2_click_1(event, $w) {
$w("#dataset1").setFilter(wixData.filter()
.contains("propType", $w('#dropdown1').value)
.or(
$w("#dataset1").setFilter(wixData.filter()
.ge("bedrooms", $w('#dropdown2').value)
)
.or(
$w("#dataset1").setFilter(wixData.filter()
.ge("bathrooms", $w('#dropdown3').value)
)
.or(
$w("#dataset1").setFilter(wixData.filter()
.ge("pool",$w('#dropdown6').value)
)
.or(
$w("#dataset1").setFilter(wixData.filter()
.ge("safetyAmenities",$w('#dropdown7').value)
)
.or(
$w("#dataset1").setFilter(wixData.filter()
.ge("accesibility",$w('#dropdown8').value)
)
.or(
$w("#dataset1").setFilter(wixData.filter()
.ge("location",$w('#dropdown9').value)
)
.or(
$w("#dataset1").setFilter(wixData.filter()
.between("priceMth",parseFloat($w('#dropdown4').value), parseFloat($w('#dropdown5').value)))
)
.then((results) => {
console.log("Dataset is now filtered");
$w("#repeater1").data = results.items;
}).catch((err) => {
console.log(err);
});
$w("#repeater1").expand();
What im trying to do is that visitors can select one or many dropdowns to make a search
But with this code I have an error Here:
.then((results) => {
console.log("Dataset is now filtered");
$w("#repeater1").data = results.items;
}).catch((err) => {
console.log(err);
}); (HERE IS MY PARSING ERROR)
$w("#repeater1").expand();
Someone help me to see what is wrong and how i can fix it please
Thanks
You need to have your expand function in a function or after a then, you can't just have it by itself like you have in your code.
Like this
export function yourButton_onclick(event) { $w("#repeater1").expand(); }
Or as below....
Have a look at this Wix tutorial and see the part about collapsing a table on load and see how they do it for hiding the table.
https://support.wix.com/en/article/corvid-tutorial-adding-collection-data-search-functionality#optionally-collapse-the-table-on-load-1
wixData.query("recipes") .contains("name", $w("#searchList").value) .find() .then(res => { $w("#resultsTable").rows = res.items; $w("#resultsTable").expand(); }); }