Reputation: 2601
Am trying to use $document.on("dialog-ready", function() { .. }
for touch UI dialog customization. Where as i can see the dialog-ready event fires before the dialog content is fully loaded which gives me a unavailability of tags for traversal of dialog html.
$document.on("dialog-ready", function() { .. }
when compares with $(document).on("foundation-contentloaded", function (e) { .. }
.?
Upvotes: 5
Views: 11201
Reputation: 217
Dialog ready is fired when a dialog is opened. Not necessarily after all values are populated. Foundation contentloaded is fired when new fields are injected into the dialog. More specifically, according to the documentation, "it should be triggered when a container is injected".
So using foundation-contentloaded
is ideal when working with multifields where new fields get added much later. Also, dialog-ready
will not be fired in page creation wizard. We have to use foundation-contentloaded here.
Neither of the two will guarantee that all content will be populated for us to start using their values in JavaScript. Especially when we have RTE/multifields in our dialog.
To answer your question,
There are no event listeners that you can use that indicates the dialog is fully loaded.
I noticed foundation-contentloaded
fires before dialog-ready
Coral.commons.ready
ensures initialization. Especially helpful when working with multifields and RTEs.
Coral.commons.ready(this, () => {
/*
logic to run once coral element 'this' is pointing to is initialized (initialize or _render methods are invoked)
*/
});
More information on foundation-contentloaded and Coral.commons.ready
Upvotes: 2
Reputation: 1
You can use:
$(document).on("foundation-contentloaded", function(e) {
var container = e.target;
});
Check this link.
Here are more examples: https://helpx.adobe.com/experience-manager/using/creating-touchui-events.html
Upvotes: 0