Hello Wix team,
I am having an issue with a Slide Deck Gallery and deleting its item using wix code. I am using a delete button to delete the contents of the gallery with the following code.
export function imagedeletebutton_click(event, $w) {
let items = $w("#gallery").items;
let currentgallerindex = $w("#gallery").currentIndex;
//if (currentgallerindex === items.length) {
//
//
// items.pop();
// $w("#gallery").items = items;
//
//
//} else {
items.splice(currentgallerindex, 1);
$w("#gallery").items = items;
//}
}
The problem I am having is that:
If the gallery contains more than one image(I can delete the image if the gallery contains only one image.), I cant delete the last image in the gallery. If I try to delete the last image, the gallery turns to white colour and nothing is happening. I guess the gallery is crashing.
Here is the screenshot of the chrome developer console. its saying rendering failed when I tried to delete the last image by clicking the delete button.
![](https://static.wixstatic.com/media/a27d24_0b256ac327574fdc9680ba673965313a~mv2.jpg/v1/fill/w_660,h_605,al_c,q_85,enc_auto/a27d24_0b256ac327574fdc9680ba673965313a~mv2.jpg)
Current situation
one image in the galery: delete operation works
Two images in the gallery: i can delete the first one without issue but if I delete second image, it crashes the gallery
Three images in the gallery: I can delete the first one or second one in any order. And when i try to delete the last image the gallery crashes
I tried using pop instead of splice as seen in the commented part of the code. But that time also I am not getting the expected result. Can anyone help me to solve this issue? Thanks.
Hey Ohad,
Have you found a solution to this issue? This is my 3rd wix bug i am reporting. And I have only got a proper solution for only one bug. Please have a look at this issue asap as this bug is delaying lot of work in my website. Thanks.
Hi,
You're right. It seems like an issue on our end with this specific Gallery type. We'll look into it. For now, I suggest that you try a different gallery type.