I’ve created a repeater that pulls in the WIX Blogs Blog/Posts collection. I also have a menu that lists years (ex. 2024, 2023, 2022, etc.). When the user clicks on a menu item I want the dataset to filter the repeater content by the selected year.
I have similar code on another site and it’s works perfectly but I seem to be encountering a problem accessing the Blog/Posts collections fields.
I receive the error (WDE0080: Validation failed)
Here is the code:
import wixData from ‘wix-data’;
$w.onReady(function () {
const d = new Date();
let year = d.getFullYear();
let yearFilterItems = [ ];
for (let i = year; i > 2005; i–){
let yearString = i.toString();
yearFilterItems.push({label: yearString})
}
$w(‘#yearFilter’).menuItems = yearFilterItems;
$w(‘#yearFilter’).onItemClick( (event) => {
let selectedYear = event.item.label;
Found a bit of a work around for what I needed. Hope this helps anyone else that comes across it
import wixData from ‘wix-data’;
import { posts } from ‘wix-blog-backend’;
$w.onReady(function () {
const d = new Date();
let year = d.getFullYear();
let yearFilterItems = ;
for (let i = year; i > 2005; i–){
let yearString = i.toString();
yearFilterItems.push({label: yearString})
}
$w(‘#yearFilter’).menuItems = yearFilterItems;
$w(‘#yearFilter’).onItemClick( (event) => {
let selectedYear = event.item.label;