Displaying users uploaded photos

Hi, really hope to get an answer here!
In my site, users can upload videos in one page (named “upload” page), and can view those videos in other page (“display” page), in a repeater that includes a video-player. the repeater and the video player pulls the videos from a collection that’s being updated with every user’s upload.
The collection which the data of the user is being saved, includes the date and the video fields.
I want to add a date-filter option in the video-display page: when I choose a date, I want only the videos that were uploaded in that date to be shown.
is there a good way doing so in wix Velo?

thanks!

I haven’t tested it, so it may not work, but you are probably looking to use the wixDataset setFilter to get this working

import wixData from 'wix-data';

//

let selectedDate = $w("#dateDropdown").value

$w("#myDataset").setFilter( wixData.filter()
  .eq("dateField", selectedDate)
);

Again, this isn’t tested and this isn’t the complete code you would need, but I hope it points you in the right direction

Thanks a lot!
it’s not working actually but nice to know it is possible.
do you know maybe what do I need to do to make it work?

@facestory2021 Are you able to post the code you have used in a code block. It’ll help to work out what you need to do

@noahlovell
the code we used is this:

import wixData from ‘wix-data’;
export function submit_click() { //user clicks the submit button
const selectedDate = $w(‘#dateInput’).value; //gets the selected date
wixData.query(“events”)
//filter eventType = private
.eq(“eventType”,“private”)
//filter the selected dates
.eq(“date”, selectedDate)
.find()
.then((results) => {
console.log(results.items);
})
.catch((err) => {
let errorMsg = err;
});
}
});

@facestory2021 Is your repeater connected to a dataset?

@noahlovell yes, we created a dataset on the video-display page

@facestory2021 You’re probably going to want to use this then:

import wixData from 'wix-data';

export function submit_click() {
    const selectedDate = $w('#dateInput').value;
    $w("#myDataset").onReady(() => {
        $w("#myDataset").setFilter(wixData.filter()
            .eq("eventType", "private")
            .eq("dateField", selectedDate)
        )
    });
}

@noahlovell again, thanks a lot
do I need to add a submit button and connect in to something?

@facestory2021 Make sure you have added the button event handler (it will look like the image). No it does not need to be connected

1 Like