Expand my Community achievements bar.

SOLVED

Deligate design pattern

Avatar

Level 2

For our requirement, I am creating a class called ListDelegate and implementing the List component interface. because i want to add extra functionlity sortBy ranking  (which i added in page properties) ,like sortBy asc and desc present in list, how to solve this thing or any other solution?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 8

Hi @knki 

 

These links might help you. check the solutions given by @VeenaVikraman 

You are utilizing the Out of the box core component feature. Plus you are adding your own customization by utilizing the Sling delegation pattern.

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/delegation-pattern-for-sli...

 

https://github.com/adobe/aem-core-wcm-components/wiki/Delegation-Pattern-for-Sling-Models

 

View solution in original post

2 Replies

Avatar

Correct answer by
Level 8

Hi @knki 

 

These links might help you. check the solutions given by @VeenaVikraman 

You are utilizing the Out of the box core component feature. Plus you are adding your own customization by utilizing the Sling delegation pattern.

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/delegation-pattern-for-sli...

 

https://github.com/adobe/aem-core-wcm-components/wiki/Delegation-Pattern-for-Sling-Models

 

Avatar

Community Advisor

@knki Check this https://github.com/adobe/aem-core-wcm-components/wiki/Delegation-Pattern-for-Sling-Models .also read https://medium.com/@veena.vikraman19/aem-avoiding-delegation-pattern-pitfalls-with-core-components-9... 

 

If you are using everything from List https://github.com/adobe/aem-core-wcm-components/blob/main/bundles/core/src/main/java/com/adobe/cq/w... as is , you can just add @delegate annotation.

 

But I assume you are going to add one more option for sorting . That means you will need to override https://github.com/adobe/aem-core-wcm-components/blob/main/bundles/core/src/main/java/com/adobe/cq/w... the `getListItems` to modify the logic of `getStaticListItems` method to add the sorting mechanism.