I have a short script attached to a button click handler that needs to display a notification. For some reason I don't see the notification window pop up, though I can log the same message to the console fine. The query below is a SELECT COUNT(*)... query.
What's wrong?
var Cnt;
await qryCountSubregions.trigger();
Cnt = qryCountSubregions.data.count[0];
if(Cnt > 0)
{
utils.showNotification("Region could not be deleted","The selected region's "+Cnt+" subregion(s) must first be deleted.","error" );
console.log("The selected region's "+Cnt+" subregion(s) must first be deleted.")
}
else
{
await qryRegionDelete.trigger();
utils.showNotification("Deletion confirmed","The highlighted record was deleted.","success");
console.log("The highlighted record was deleted.");
}
i've noticed that notifications don't always show when you're in edit mode and you've been entering & exiting preview mode. this has been a longstanding bug/idiosyncrasy in my experience.
if you reload the page, and proceed immediately to the action that causes the notification, does it show?
Alas, no. I can live with it in this particular context - just displaying a label with the same message - but it's going to be a problem elsewhere, I have a feeling. Guess we'll cross that bridge when we come to it.
I should've looked closer at your posted code; I believe it has to conform to the function's object argument format to work, i.e. it won't infer based on argument ordering what is what.