Refresh Current Page Elements

I’m using a repeater with pagination connected to a dataset. When a repeater item is clicked, it opens a lightbox and data is updated by user. When the lightbox closes, I would like the dataset to refresh, but keep the current page of repeater items.

What I’ve tried:


1. Update elements using .refresh()

wixWindow.openLightbox(lightbox, {
    "item": currentItem,
    "itemId": currentItemId
})
.then(() => {
    $w(dataset).refresh();
});

Result:
The dataset refreshes, but loses pagination spot. I could set the page after the refresh, but it’s not a great option.


  1. Update elements using currentPage
let currentPage = $w("#pagination1").currentPage;  

wixWindow.openLightbox(lightbox, {
    "item": currentItem,
    "itemId": currentItemId
})
.then(() => {      
    $w("#pagination1").currentPage = currentPage;
    console.log(currentPage) //logs correct page    
 }); 

Result:
Dataset does not update. Not sure why.

From the documentation:
If the pagination bar is connected to a dataset, setting currentPage updates the current page of the dataset and updates any relevant elements connected to that dataset.