Customize the "list" component | Community
Skip to main content
Level 3
October 16, 2015
Solved

Customize the "list" component

Can we customize the "List" component to add the "cq:lastReplicated" in the orderby dropdown. Tried by adding "cq:lastReplicated" in the dropdown value, but its not sorting.  Can u please help.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Sham_HC
Sham_HCAccepted solution
Level 10
October 16, 2015

The sorting of the list component is implemented by using Java Collections.sort() together with custom Comparators. To change the sorting order, you could do a similar implementation and could control the sorting orders by using different custom Comparators. API details at [1]. The steps are

* Create a custom Comparator<Page>
* In the list component set setOrderComparator with your custom one.
 

The alternative another option is use advanced search feature of list and have query predictor to return as per your need. 


[1] http://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/wcm/foundation/List.html

11 replies

Level 3
October 16, 2015
I have tried that too.. activated a particular page and tried sorting. But it's not working but the cq:lastmodified which is present in default LIST component works fine. Any help to sort this problem would be very helpful. Thanks...
Translate