Expand my Community achievements bar.

Join us in celebrating the outstanding achievement of our AEM Community Member of the Year!
SOLVED

Custom script is not rendering on AEM dialog

Avatar

Community Advisor

Hey Guys,

I have written some custom logic on dialog level to show some images.

For example - I have a product code which is authorable in the component dialog, now once someone selects the product code in dialog, I am previewing the image just below the select field. I am using granite:class and showing it.

but once I close the dialog and reopen it, the image is not visible.

 

I tried with all types of dialog-ready conditions but nothing is working out. Can someone suggest how can I retain the image in dialog?

 

Thanks,

Prince

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi prince,

 

You may need to write the same login on foundtaion-contentload event as well.

   $document.on("foundation-contentloaded", function (e) {
        fetchProductImage(onLoadFlag);
    });

    $document.on("change", contentTypeSelector, function (e) {
        fetchProductImage(!onLoadFlag);
    });

 

I implemented something similar for the dynamic dropdown https://aemlab.blogspot.com/2022/01/aemaacs-touch-ui-dialog-dynamic-dropdown.html 

 



Arun Patidar

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi prince,

 

You may need to write the same login on foundtaion-contentload event as well.

   $document.on("foundation-contentloaded", function (e) {
        fetchProductImage(onLoadFlag);
    });

    $document.on("change", contentTypeSelector, function (e) {
        fetchProductImage(!onLoadFlag);
    });

 

I implemented something similar for the dynamic dropdown https://aemlab.blogspot.com/2022/01/aemaacs-touch-ui-dialog-dynamic-dropdown.html 

 



Arun Patidar