Hi,
I have a dynamic page that displays items, I also created a table where users can filter items depending on 3 criteria (search bar, select category, select retailer) but I also want items to display according to the value of a checkbox, that would be ‘show/hide items that have expired’.
I’ve already added a boolean field (dispo) in the database, which I check if the item has expired.
Here my code
import wixData from 'wix-data';
$w.onReady(function () {
$w("#dynamicDataset").onReady( () => {
$w("#repeater2").onItemReady( ($w) => {
$w("#repeater2").forEachItem( ($w) => {
//strikes through 'previous price'
$w("#text63").html = `<span style="font-family:arial; font-style: italic; color:#C0C0C0; text-decoration: line-through;font-size:17px">${$w("#text63").text}</span>`;
} );
//modifies the time and date
const originalDate = $w("#text62").text;
const newDate = originalDate.split(' ').splice(1, 4).join(' ');
$w('#text62').text = newDate;
console.log('Time removed from Date/Time Stamp: New Date ' + newDate);
});
});
});
//searches keywords typed in the search bar upon pressing 'Enter'
export function searchInput_keyPress(event, $w) {
if (event.key === "Enter") {
$w("#dynamicDataset").setFilter(wixData.filter()
.contains("title", $w("#searchInput").value)
.contains("categorie", $w("#categorieInput").value)
.contains("vendeur", $w("#vendeurInput").value));
}
}
//searches after typing in the search text input
export function shape18_click(event, $w) {
$w("#dynamicDataset").setFilter(wixData.filter()
.contains("title", $w("#searchInput").value)
.contains("categorie", $w("#categorieInput").value)
.contains("vendeur", $w("#vendeurInput").value));
}
//selects the 'categorie' input
export function categorieInput_change(event, $w) {
$w("#dynamicDataset").setFilter(wixData.filter()
.contains("title", $w("#searchInput").value)
.contains("categorie", $w("#categorieInput").value)
.contains("vendeur", $w("#vendeurInput").value));
}
//selects the 'vendeur' input
export function vendeurInput_change(event, $w) {
$w("#dynamicDataset").setFilter(wixData.filter()
.contains("title", $w("#searchInput").value)
.contains("categorie", $w("#categorieInput").value)
.contains("vendeur", $w("#vendeurInput").value));
}
//resets the 'categorie' input
export function shape16_click(event, $w) {
$w("#categorieInput").value = null;
$w("#dynamicDataset").setFilter(wixData.filter()
.contains("title", $w("#searchInput").value)
.contains("categorie", $w("#categorieInput").value)
.contains("vendeur", $w("#vendeurInput").value));
}
//resets the 'vendeur' input
export function shape17_click(event, $w) {
$w("#vendeurInput").value = null;
$w("#dynamicDataset").setFilter(wixData.filter()
.contains("title", $w("#searchInput").value)
.contains("categorie", $w("#categorieInput").value)
.contains("vendeur", $w("#vendeurInput").value));
}