Sagar
Sagar

Reputation: 35

Customize the "list" component

My requirement is to sort and display the page title of the pages based on last Published date in component present in another page. So can we customize the "List" component to add the "cq:lastReplicated"in the orderby drop-down. Tried by adding"cq:lastReplicated"` in the drop-down value, but its not sorting. Any help please.

Upvotes: 1

Views: 1012

Answers (1)

rakhi4110
rakhi4110

Reputation: 9281

The orderby doesn't work with cq:lastReplicated because cq:lastReplicated is a date property, but PageComparator used in /libs/foundation/src/impl/src/main/java/com/day/cq/wcm/foundation/List.java considers only jcr:created, cq:lastModified and cq:lastPublished as date and the remaining would be considered as String.

Due to this, cq:lastReplicated would be treated as String and the comparison would result in incorrect order.

You can try overlaying the list component under /apps and then call your custom Java class which would consider cq:lastReplicated as Date instead of String.

Upvotes: 1

Related Questions