Problem Loading Dynamic Gallery

There is a problem with populating a gallery with content.
Basically when viewing a car( dynamic item page ), the gallery(which has items from another database that is filtered to only show based on the current dynamic item ), when you click on another car from the bottom(there is a repeater that showcases other cars ) it changes the info from the dynamic dataset, but the gallery doesn’t change.

More specifically:
https://www.automotivemarket.ca
(it will be only for mobile - so basically desktop version design is just the elements thrown there).
The setup is quite straight forward the main database CARS , and a database IMAGES .
Images have an image field, and a " cars " reference field, referenced back to cars.

On the dynamic page, the gallery dataset is filtered to show only images from the current item( Car ) - from dynamic dataset.

On the bottom of the page there is the “recomended cars” which is basically a repeater, showing other cars(from the CARS database).

On container onclick there is this

wixLocation.to("/redirect?id=" + $item("#dataset2").getCurrentItem()["link-Ads-_id"])

Basicly, at first i just had it like this

wixLocation.to($item("#dataset2").getCurrentItem()["link-Ads-_id"])

But it kept not loading the gallery correctly ( it was keeping the last item’s images, not the current ones.)

So what i did is create a “Redirect” page and pass the link of the car there, and on the redirect page get the link of the car and redirect the user to it.I thought it would fix the issue and load the Gallery succesfully.Nothing.

I even tried re-filtered the images dataset(onready)…(even though i already have set the filter from the Dataset Filter UI)

await $w("#dataset1").setFilter(wixData.filter()
            .eq("ad", $w("#dynamicDataset").getCurrentItem()._id)
        )

Im just out of ideas as to what is goig on…

1 Like

Yes - Can this be looked at please?
Here is the issue live example

https://youtu.be/wQwkK_C29ec

1 Like

Anyone?

.

Hi!

If you have a dataset that is only used for the gallery, can you please try to call ‘refresh()’ on it when the dynamic dataset is ready?
something like:

export function dynamic_ready() {
    //do some code here
    $w('#dataset1').refresh();
}

Otherwise, can you try updating the gallery data with code?

I tried that, no luck.
When the issue occurs, where the gallery is not populated correctly, if you refresh the page manualy the gallery gets the correct images.

By code you mean running a query on the images database for that specific car ref, and then pass the results to the gallery?

@maria-fikata Yep :slight_smile:
Please try it and let me know if it worked for you.
We’ll take a look at the refreshment issue.

@liran-kurtz-wix Changed to that…Still it doesn’t populate the correct car…ultra weird… i console.logged the item before quering it and it is the correct one…

let id = $w("#dynamicDataset").getCurrentItem()._id;
console.log($w("#dynamicDataset").getCurrentItem()) // Here i get the correct item info on the console.
wixData.query("Images")
    .eq("ad", id)
    .find()
    .then(function (results) {
    if (results.items.length > 0) {
         let array = results.items;
            array.forEach(function (e) {
                e.src = e.image;
         });
        $w("#gallery1").items = array;
        $w("#gallery1").expand()
    } else {
        $w("#gallery1").collapse()
    }
 })

I noticed after i changed 3-4 cars from the just posted ones, that it gets to the previous clicked one. The first time i change nothing happens, the next times it gets the previous items.

  • I’m on Car 1 and clicking on Car 2 , doesn’t change the gallery(gallery stays on Car 1 ,info of Car 2 is loaded)

  • I’m clicking on Car 3 , and getting the Car 2 's images.( Car 3 info is loaded, but gallery loads Car 2 )

  • I’m clicking on Car 4 and getting the Car 3’s images.( Car 4 info is loaded, but gallery loads Car 3 )

.

@Maria Fikata, it is an issue with Pro-Gallery at our end. The easiest temporary solution till issue fix is to change gallery type to standard galleries e.g. a standard grid-gallery.

I’ve already selected a standard gallery. WIX Pro Gallery Standard Grid

I’ve already selected a standard gallery. WIX Pro Gallery Standard Grid Can you screen shot the Gallery you’d like me to select please?

Yeah we use a pro gallery at the moment. Will try using standard gallery and let you know thanks for the answer

@olesiaz I tried using the standard gallery(not wixpro), but now it still not behaving correctly…

@liran-kurtz-wix I tried using the standard gallery(not wixpro), but now it still not behaving correctly…

@liran-kurtz-wix Something i just noticed, i think it might help, the only cars that have issue with the gallery are the ones that have images not hosted at wix, but inserted in to the database via URL.

@olesiaz Something i just noticed, i think it might help, the only cars that have issue with the gallery are the ones that have images not hosted at wix, but inserted in to the database via URL.


Any gallery from these sections works for me.

Our website now loades much faster and is more responsive without thr wix pro gallery but extera images dont load - can you please help!