Hello All,
There is a requirement to add custom sort order date option in Core List v3 component as below.
Also we want this core List component should be restricted to fetch only Article and Article category templates. I know I need to extend core list component but I am unsure the way how to implement this. Do I need to re-write logic of core List component(java code) to fetch only article/article-category pages based on which kind of list we want like Fixed list or Child page or Tags and on top of that sort it by different option like custom sort oder or title or list modified? In this case I need to re-write all logic of core List interface. Is there any other way to achieve this?
Solved! Go to Solution.
Views
Replies
Total Likes
Hello @supriya-hande ,
For your requirement, the best practice is using Sling Delegation Pattern where you need to change the logic of "Options for Child Pages" in your Java implementation class.
The core list implementation: https://github.com/adobe/aem-core-wcm-components/blob/main/bundles/core/src/main/java/com/adobe/cq/w...
Sling Delegation Pattern Doc: https://medium.com/@veena.vikraman19/aem-avoiding-delegation-pattern-pitfalls-with-core-components-9...
Example: https://github.com/Sady-Rifat/aem-demo/commit/7047cd9dcb6601359f61d13b373da552272ca8cc
Still, if you find any trouble let me know.
Hello @supriya-hande ,
For your requirement, the best practice is using Sling Delegation Pattern where you need to change the logic of "Options for Child Pages" in your Java implementation class.
The core list implementation: https://github.com/adobe/aem-core-wcm-components/blob/main/bundles/core/src/main/java/com/adobe/cq/w...
Sling Delegation Pattern Doc: https://medium.com/@veena.vikraman19/aem-avoiding-delegation-pattern-pitfalls-with-core-components-9...
Example: https://github.com/Sady-Rifat/aem-demo/commit/7047cd9dcb6601359f61d13b373da552272ca8cc
Still, if you find any trouble let me know.
Hello @supriya-hande
Please use the Delegation pattern as suggest by @Sady_Rifat . That will help us customize only whats needed.
You might still have to copy some code, which stays the same but will still be able to avoid plenty.
Regarding filtering:
Regarding Sorting:
- Sorting is done after filtering, in same getPages()
You can add more sort criterions and extend accordingly
@supriya-hande Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes
Views
Likes
Replies