Esta conversación ha sido bloqueada debido a la inactividad. Cree una nueva publicación.
Nivel 1
Nivel 2
Iniciar sesión en la comunidad
Iniciar sesión para ver todas las insignias
Esta conversación ha sido bloqueada debido a la inactividad. Cree una nueva publicación.
Is there a way to change component's ID when called by data-sly-resource?
I have a object list and uses data-sly-resource to iterate each resource.
The problem is that the IDs for each component called uses the ID of the parent component, therefore encountering an issue with ID not being unique.
¡Resuelto! Ir a solución.
Vistas
Respuestas
Total de me gusta
You can always write a java function in the use class of the parent component ( from where you are calling data-sly-resource) or the component itself.
The function should return a random integer value and then you can use that value to assign it to the element id.
Vistas
Respuestas
Total de me gusta
@LyonMartin Please check below article for your reference:
https://blogs.perficient.com/2018/06/12/aem-development-quick-tip-component-unique-id/
Vistas
Respuestas
Total de me gusta
Will look into that. Thanks!
Vistas
Respuestas
Total de me gusta
Doesn't work on my end. Called components still uses the ID of the parent (it still shows something like "calledComponentName-{parentHash}"). Called components don't even show in the CRXDE, I guess that's why it wont work.
Any solutions for this?
Vistas
Respuestas
Total de me gusta
You can always write a java function in the use class of the parent component ( from where you are calling data-sly-resource) or the component itself.
The function should return a random integer value and then you can use that value to assign it to the element id.
Vistas
Respuestas
Total de me gusta
Hi AnmolBhardwaj1808 , I tried creating a resource map on my end to add the ID (as well as the item index), it works, though I'm having problems passing this value to the "child" component.
I found this one in the stackoverflow, though I still haven't figured out how to use the selectors in data-sly-resource.
https://stackoverflow.com/questions/35188462/passing-selector-in-data-sly-resource-in-sightly
Thanks,
Martin
Vistas
Respuestas
Total de me gusta
About this, I misplaced the creation of id to the resouce creation.
I just added it to the resource map and it's now working.
Many Thanks,
Martin
Vistas
Respuestas
Total de me gusta
Vistas
me gusta
Respuestas