Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

How to make core component (download component v2) to show/hide "file size" property with a checkbox reference

Avatar

Level 2

I am working with one of the core component (download component v2).

 

When I author the dialog with any file, it shows file name, file size along with download option.

 

My requirement is that, I have added a checkbox under properties tab under download component.

 

When checkbox is selected while authoring, only then the file size property should show up, and if checkbox is not selected, it should not show file size info for download component.

 

I have added checkbox under properties tab of download component and wrote a slingmodel to get the checkbox node property to sling model.

 

Can someone let me know how can I get the desired result as mentioned above from here Please? Also help me with code to accomplish this requirement? Thanks in advance!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @srk381 

 

There is a getFileSize method in components: https://github.com/adobe/aem-core-wcm-components/blob/525cbab6e5a1bd5a8628da7217328fd80016a5c1/bundl.... Simply you can delegate your model and show and hide the value it is returning on your custom method.

 

Delegating: https://kiransg.com/2021/11/07/aem-core-component-delegation/

Kiran_Vedantam_0-1673299080441.png

 

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi @srk381 

 

There is a getFileSize method in components: https://github.com/adobe/aem-core-wcm-components/blob/525cbab6e5a1bd5a8628da7217328fd80016a5c1/bundl.... Simply you can delegate your model and show and hide the value it is returning on your custom method.

 

Delegating: https://kiransg.com/2021/11/07/aem-core-component-delegation/

Kiran_Vedantam_0-1673299080441.png