Hi,
Pretty new to WIX, created a site that generates a inventory page via repeaters pulling from a dataset. Then, when an item is selected it creates a dynamic item page - all pretty straight-forward stuff. However, the item page has a gallery which pulls pictures from the dataset. The code to do this is:
import wixData from ‘wix-data’;
$w.onReady( function () {
let pic1 = $w(“#dynamicDataset”).getCurrentItem().pic1;
let pic2 = $w(“#dynamicDataset”).getCurrentItem().pic2;
let pic3 = $w(“#dynamicDataset”).getCurrentItem().pic3;
let pic4 = $w(“#dynamicDataset”).getCurrentItem().pic4;
let pic5 = $w(“#dynamicDataset”).getCurrentItem().pic5;
let pic6 = $w(“#dynamicDataset”).getCurrentItem().pic6;
let pic7 = $w(“#dynamicDataset”).getCurrentItem().pic7;
let pic8 = $w(“#dynamicDataset”).getCurrentItem().pic8;
let pic9 = $w(“#dynamicDataset”).getCurrentItem().pic9;
let pic10 = $w(“#dynamicDataset”).getCurrentItem().pic10;
let pic11 = $w(“#dynamicDataset”).getCurrentItem().pic11;
let pic12 = $w(“#dynamicDataset”).getCurrentItem().pic12;
let pic13 = $w(“#dynamicDataset”).getCurrentItem().pic13;
let pic14 = $w(“#dynamicDataset”).getCurrentItem().pic14;
let pic15 = $w(“#dynamicDataset”).getCurrentItem().pic15;
let pic16 = $w(“#dynamicDataset”).getCurrentItem().pic16;
let pic17 = $w(“#dynamicDataset”).getCurrentItem().pic17;
let pic18 = $w(“#dynamicDataset”).getCurrentItem().pic18;
let pic19 = $w(“#dynamicDataset”).getCurrentItem().pic19;
let pic20 = $w(“#dynamicDataset”).getCurrentItem().pic20;
$w(“#gallery1”).items = [ { src: pic1, }, { src: pic2, }, { src: pic3, }, { src: pic4, }, { src: pic5, }, { src: pic6, }, { src: pic7, }, { src: pic8, }, { src: pic9, }, { src: pic10, }, { src: pic11, }, { src: pic12, }, { src: pic13, }, { src: pic14, }, { src: pic15, }, { src: pic16, }, { src: pic17, }, { src: pic18, }, { src: pic19, }, { src: pic20, }];
} );
This doesn’t feel like the most elegant way to do this, but it works - given there are always 20 pics (which there are). Also, there are other ‘non-gallery’ elements on the item page that pull from the same data-set.
Here’s the problem . When an item page is manually refreshed via the browser the gallery pictures never reload . All other elements do. This is consistent on Safari and Chrome (iPad/iPhone or Apple Desktop/Laptop). Have not tested it with Windows - but will soon.
The only fix is to go to the inventory page via the menu, refresh/reload that page, and then follow the links to recreate the dynamic item page.
Because only the gallery pic elements are not loading during a refresh, I’m thinking there’s something with the code above that doesn’t play well with a page reload.
Not a coder, the code used above was mentioned in another thread and happened to work.
Thanks for any help,
/Fac