Hey,
I want to set a filter on the homepage and show the results on another page.
Here’s a code from the forum:
Homepage:
import {local} from 'wix-storage';
import wixLocation from 'wix-location';
export function searchButton_click() {
let word = $w("#searchBar").value;
local.setItem("searchWord", word);
wixLocation.to(`/results`);
}
Page:
import {local} from 'wix-storage';
import wixData from 'wix-data';
$w.onReady(function () {
var sameWord = local.getItem("searchWord");
$w("#searchBar").value = sameWord;
$w("#searchBar").placeholder = sameWord;
$w('#nameDataset').onReady(function () {
search();
});
});
export function searchButton_click() {
search();
}
function search() {
wixData.query('Name')
.contains('name', $w("#searchBar").value)
.or(wixData.query('Name').eq('number', $w("#searchBar").value))
.find()
.then(res => {
$w('#repeater1').data = res.items;
});
}
How do I make this for individual checkboxes ? I have no value here. So I have to check if the checkbox is checked and set the checkbox on the new page checked.
But what’s the right code for this ?