Hey, I have a specific page with a Repeater and Filtering option. I would like to allow users to save different items on the repeater and then have a repeater on their profile page showing all the items they have saved. How would one go about implementing that?
Hello Yann,
sorry but your description is a little bit confusing. Try to describe more detailed and systematic.
- I have a repeater (repeater_ID) on a static page (page-name).
- connected trough a dataset (dataset-ID) with my database (Database-name).
- When i click on the button-X (button_id). then bla bla bla, happens, & so on.
-How does your “save”-process looks like? (something pressed inside repeater)
…and then have a repeater on their profile page showing all the items they have saved
This part is easy be done by connecting the results with a repeater.
Hey, sorry my post wasn’t clear. I actually don’t have a “saving system” so I was wondering what the best way to implement one would be.
Ok, so you have NOTHING right now, don’t you?
Take a look onto my site, perhaps one of the various examples there will give you a first idea, what and how to realize your project.
Hey, I’m sorry but I couldn’t find much on your site. I currently have a repeater on a page (lets call it page1) connected to a dataset. And a repeater on the users profile page connected to the same dataset. I want the user to be able to “save” items on the repeater on page1 by clicking a button. Then if the user goes on their profile page all the saved programs would appear on that repeater. How would I go about implementing the process of collecting the data of what entries have been saved and then using that data to filter the repeater on the profile page would be my question. Sorry if I wasn’t specific enough before…
Hello again,
well first question is, if the button is inside repeater or outside repeater?
I want the user to be able to “save” items on the repeater on page1 by clicking a button.
You do not save items into repeaters, you save items into databases with the help of datasets. Repeaters just shows the results of databases with the help of datasets.
Here is a saving process…
https://www.wix.com/corvid/reference/wix-dataset/dataset/setfieldvalue
$w("#myDataset").setFieldValue("title", "New Title");
$w("#myDataset").save();
Then if the user goes on their profile page all the saved programs would appear on that repeater
This is already another step!
Here you can do a query of your database and show the results by repeater…
import wixData from 'wix-data';
2
3// ...
4
5wixData.query("myCollection")
6 .find()
7 .then( (results) => {
8 if(results.items.length > 0) {
9 let firstItem = results.items[0]; //see item below
10 } else {
11 // handle case where no matching items found
12 }
13 } )
14 .catch( (err) => {
15 let errorMsg = err;
16 } );
something like…
$w('#repeater1').data = results
@russian-dima Thanks so much that makes a lot of sense! I just have a follow-up question. How do I create a personalised dataset for every member (to add the items they saved)? Because when one member saves an item I want it to be only saved for them and not for everyone who uses the site…
Look up Wishlist tutorial on YouTube … this is what you are looking to do.
Well, first take a look at the suggested video of (CQN), perhaps it will already solve your question, if not you come back here.
Good-luck and happy coding.