Dear All, I just need and help to fix a code in a dynamic page collection.
In this page of a Real Estate company, https://www.homepluscasa.com/listaimmobili
we need to add another filter, "TIPOLOGIA" that shall work with : .contains, 'cause it is a text
but I guess I did something wrong 'cause it is not working.
Please find the following code :
import {wixData} from 'wix-data';
export function button24_click_1(event, $w) {
$w("#dynamicDataset").setFilter(wixData.filter()
.contains(("citta", $w('#dropdown1').value)
.contains("tipologia", $w('#dropdown5').value)
.between("prezzo",parseFloat($w('#dropdown2').value), parseFloat($w('#dropdown4').value)))
.then((results)=> {
console.log("Dataset is now filtered");
$w("#repeater2").data = results.items;
}).catch((err)=> {
console.log(err);
});
$w("#repeater2").expand();
}
Here you could find the code with the string contain the TIPOLOGIA filter as well,
but in the on line page I just removed to make the page working correctly for now.
All the other string work correctly
Any suggestions ?
Dear Angelina,
thank you so much for your help!
The issue that i have it is about the #dropdown5, that you can't see now in the live web site, 'cause was not working correctly.
How could I add other dropdown with value text ? Before I add
.contains("tipologia", $w('#dropdown5').value) but was not working
do you might have any suggestions ?
Hi there!
I have checked your site and can see that you had a few syntax errors in your code (extra parentheses). I can also see that some parts of your code were misplaced.
This is how I've changed the code to correct this:
import { wixData } from 'wix-data'; export function button24_click_1(event, $w) { $w("#dynamicDataset").setFilter(wixData.filter() .contains("citta", $w('#dropdown1').value) .between("prezzo", parseFloat($w('#dropdown2').value), parseFloat($w('#dropdown4').value))) .then((results) => { console.log("Dataset is now filtered"); $w("#repeater2").data = results.items; $w("#repeater2").expand(); }).catch((err) => { console.log(err); }) }