Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

DropDown Lists: Linking to items instead of adding?

Avatar

Former Community Member
Hi all,



I have created a PDF in which I read from a data source and add the elements to a dropdown box (in the box's INITIALIZE event). Works just fine.



However, I have a large number of identical fields on my form (i.e. a table in which each row contains a "country" dropdown). Consequently, the form a) takes quite some time to render and b) is rather large (as every single dropdown stores all countries)...

Now, what I am trying to do is bind the dropdown itself to a data node *without* adding all elements to all dropdowns, but somehow I can't find the right start.



Anybody has thoughts on this?



Best regards

Daniel
1 Reply

Avatar

Former Community Member
You can use dynamic binding to bind each list box to data from your data file (you may have already done that, from what you wrote).



But I'm not sure how you can "share" that same binding across all fields, so that each dropdown doesn't need to bind separately to the (same) data. You can't just set each dropdown to "global" binding, because that will make the value of the dropdown global, not the items. I'll look into how to do what you want.



One possibility would be to "lazy-load" each dropdown only when it's used; write some script on the Enter even to populate it. Maybe bind some hidden list to the data you have, and then use script in each visible dropdown to populate it using the same items in your stored list, but only populate it on Enter? And, check if it's already populated (on enter) so you don't do it again if it's not needed.



Mike