The goal: create 1 dynamic page that feeds into 2 collections and also displays data from user input IN A TABLE on that same dynamic page. All user defined input must be editable/updateable.
1.) Dynamic member profile page feeds into my ‘member’ collection perfectly and displays information on the logged in user. The ‘member dataset’ and ‘member item’ are both present on my page. The page is created when members sign up using a query and insert script:
// check if there is an item for the user in the collection
userEmail = email;
return wixData.query("Farmer_Bio", "OfferingList")
.eq("_id", userId)
.find();
} )
.then( (results) => {
// if an item for the user is not found
if (results.items.length === 0) {
// create an item
const toInsert = {
"_id": userId,
"email": userEmail
};
// add the item to the collection
wixData.insert("Farmer_Bio", toInsert)
.catch( (err) => {
console.log(err);
} );
On to the challenge:
2.) My members make offers on my site, so i’ve created an ‘offers’ collection. Offers are both captured as well as displayed on the dynamic members page described above. On this same page Ive created user input fields that populate my ‘offers’ collection. The offers should remain in the fields after submission so the user can update them in the future. (Much like the members profile info above.)
3.) After the used submits their offers the data goes into the ‘offers’ collection. I have created a table that is linked to the ‘offers’ collection. Again, this table is located on the dynamic member profile page in point 1 above. Since this is basically a user dashboard I’d like the table to display only the offers that the user has created. I understand that this is a filter function, but none of my filter scripts work on my table. I would like to filter for “_owner” and the table should not display any information until the user submits an offer. After the user submits an offer to the "offers’ collection the table should refresh with the new - user specific offers - displayed. I plan on a max of 5 offers per user…
Can you help me with this code?
Thank you so much in advance.