I have this homepage layout that contains a dropdown and a dataset repeater that the dropdown has been successfully connected to the dataset repeater as a search/filter dropdown without using any code.
But I should show up a lightbox alert when a user choose a dropdown value and that the dropdown value is not exist in the dataset . The lightbox will inform the user that the data is not available yet.
Would you please help me what should I do to do that? Unfortunately, I’m new to the Javascript world and Velo world. But I’ll do my best to understand. This is the last try that I did but still not working.
import wixWindow from 'wix-window';
import wixData from 'wix-data';
$w.onReady(function () {
// Write your JavaScript here
// To select an element by ID use: $w("#elementID")
// Click "Preview" to run your code
dropdown1();
});
export function dropdown1_onChange(event) {
if ($w('#dropdown1').value) {
$w('#dataset1').onReady( () => {
let item = $w('#dataset1').getCurrentItem();
console.log("dataset");
if (item) {
console.log("lightbox close");
wixWindow.lightbox.close();
} else {
console.log("lightbox open");
wixWindow.openLightbox("Kosong");
}
});
}
}
Thank you for your kindness😊