Hi Sushma,
Sorting pages alphabetically in AEM, particularly for specific folders, involves understanding and potentially extending the functionality of the existing datasource and views. Based on your problem statement, there are a few key points and approaches you can consider:
Key Observations and Challenges:
-----------------------------------------------------
i) cq/gui/components/common/wcm/datasources/childpages:
The sling:resourceType you mentioned points to an out-of-the-box (OOTB) datasource used for fetching child pages. If you cannot locate this path, it could be because the Sling model or the datasource is either not extended or not exposed directly in your instance. It might also be included in a bundle or service rather than as a visible node in CRX.
ii) JSP Customization (/apps/cq/gui/components/coral/admin/page/columnitem/columnitem.jsp):
While you can manipulate titles and page names with this JSP, it does not directly control the sorting of pages in the datasource. Sorting needs to happen at the datasource or query level, not in the rendering layer.
--> Customize the Datasource
- To implement alphabetical sorting, you need to overlay the OOTB datasource or create a custom datasource.
- Steps:
- Identify the childpages datasource implementation.
- Overlay it to /apps/cq/gui/components/common/wcm/datasources/childpages.
- Modify the query or logic to include sorting by jcr:title or jcr:name in ascending order.
- Example Query:
query.setSortOrder("jcr:title", QueryBuilder.DESCENDING); - Register the updated datasource in your dialog or view configuration.
Regards,
Manvi Sharma