Hello there.
I am beginner in wix programming. I am having problem with setting multiple filters.
I am building the hotel database in one repeater set on page and I need it to be filtered by:
- name (text input field),
- region and hotel category (two dropdowns)
- options in three checkboxes (discounts etc.)
And everything should work together unse search (“Szukaj”) button.
When I put dropdowns to the code - it works. Or text field alone. But all together fails.
I based my code on this video:
This is my sub-site:
https://hqservices.wixsite.com/polhot/obiekty
And that’s the code for hotels website (“Obiekty”):
import wixData from ‘wix-data’ ;
export function button6_click(event, $w) {
$w( “#dataset1” ).setFilter(wixData.filter()
.contains( “region” , $w( ‘#dropdown1’ ).value)
.eq( “kategoryzacja” , $w( ‘#dropdown2’ ).value)
.contains( “title” , $w( ‘#input4’ ).value)
.eq( “znizka” , $w( ‘#checkbox1’ ).checked)
.eq( “wymianaVoucherowa” , $w( ‘#checkbox2’ ).checked)
.eq( “bonTurystyczny” , $w( ‘#checkbox3’ ).checked))
.then((results) => {
console.log( “Dataset is now filtered” );
$w( “#listRepeater” ).data = results.items;
}). catch ((err) => {
console.log(err);
});
$w( “#listRepeater” ).expand();
}
And one more info. On the end I get error message:
" TypeError: Cannot read property ‘items’ of undefined"
Even for those parts of code which works (dropdowns).
Apart from all above my site work horrible slow.
Let me know please what can I improve to make it work.
Thanks