Hi everyone,
I’m having a fairly strange issue with my dynamic page. When my dynamic page is displayed, instead of only showing items in a specific category, it’s displaying all items in the database. However, when I refresh the page or open the page up a second time, the correct items in the category are being displayed. I don’t understand what’s going on.
I’ve spoken to the Wix Support team and they’ve confirmed that all my elements are connected to my database properly and my dynamic page is set up correctly. I then asked if the custom code used to link each item’s button to a specific lightbox could be the problem, but I was referred to the Wix Code Forum.
Here is the code I used:
import wixData from ‘wix-data’;
import wixWindow from ‘wix-window’;
$w.onReady( function () {
wixData.query("Steps")
.find()
.then((results) => {
$w(`#repeater1`).data = results.items;
})
. **catch** ((err) => {
**let** errorMsg = err;
});
$w(`#repeater1`).onItemReady(($w, itemData) => {
console.log(itemData);
$w(`#button1`).onClick((event)=>{
wixWindow.openLightbox(itemData.lightbox);
});
});
});
Here is a more descriptive explanation of my problem. I have a database with bunch of steps ranging from step 1 to step 17. Each step belongs to a specific category, which is known as a phase in my site, for example the Analysis phase. The Analysis phase has 8 steps; however, when I open the Analysis phase page, all 17 steps are shown. When I refresh the page, only the 8 steps in the Analysis phase are shown. Each step that is displayed on the dynamic page has a button that links to a specific lightbox, which is achieved with the code extract above. Any ideas on why this strange issue is happening?
Any assistance will be appreciated.