Can I have a lightbox launch when the website loads, if a boolean value in my dataset is true?

Hi Folks,

I have a website that displays Covid19 figures for Ireland, following their publication from the government. I have a lightbox (#lightbox1) that displays an ‘Update in Progress’ window for when I’m updating the figures, which I would like to launch when people enter the site, if the boolean value ‘updating’ is true in #dataset1

Is this possible?

Many thanks!

Hi,
for this, you can get the current dataset’s item

let itemObj = $w("#myDataset").getCurrentItem();

The create a condition that will check if the current item’s field “updating” is true or false.

if (itemObj.updating === true) { open lightbox }

Thanks! @aleksf I’ve tried that now with the following code but it doesn’t seem to be working. I should add, the dataset is a 1 row database.

import wixWindow from 'wix-window';

$w.onReady( () => {
$w("#dataset1").onReady( () => {
let item0bj = $w("#dataset1").getCurrentItem();
if (item0bj.updating === false) {
wixWindow.openLightbox("updateBox");
}
} );
} );