Hello there,
I’m having a hard time figuring this thing out and I’m running out of time (I have a deadline in a few days).
I am quite new to the code and not really prepared with java in general, so I apologive in advance if any of this sound silly.
Basically I’m working on a Travel agency website with a complex search.
I have a page showing packages (a repeater connocted to a dataset).
I want to be able for users to filter (or search) the repeater through one input filed, 2 dropdowns, a series of checkboxes and one radiobutton.
I want certain groups of checkboxes to push their values to a filter of one field and other checkboxes to other fields.
I’ll explain:
Period: january, february etc (this group relates to the field contiainig the months in the database)
Other Filters: Sea, Cities, Art etc (this group refers to the field named Tags)
and so on.
I understand I need to store the values in an array to the push it into the filters, but I cannot figure how to do it.
I can share links if needed of course.
Any help here would be suuuper appreciated. I’ll be thankful forever!
So far my code is:
import {local} from ‘wix-storage’;
import wixData from ‘wix-data’;
export function searchButton_click() {
search();
}
$w.onReady(function () {
var sameWord = local.getItem(“searchWord”);
$w("#iDestinazione").value = sameWord;
$w("#iDestinazione").placeholder = sameWord;
var samePeriodo = local.getItem("optionPeriodo");
$w("iPeriodo").value = samePeriodo;
$w("iPeriodo").placeholder = samePeriodo;
$w('#dataset1').onReady(function () {
search();
});
});
function search() {
wixData.query(‘Pacchetti_Viaggio’)
.contains('destinazione', $w("#iDestinazione").value)
.gt('dataFine', new Date())
.find()
.then(res => {
$w(‘#repeater1’).data = res.items;
});
}