Trying to implement sorting for custom column in collections list view | Community
Skip to main content
June 12, 2024
Solved

Trying to implement sorting for custom column in collections list view

  • June 12, 2024
  • 3 replies
  • 947 views

Hi All,

I am trying to add basic sorting asc/desc for a custom column in collections list view in AEM cloud service.

I was to add the custom column by overlaying /libs/dam/gui/content/collections/jcr:content/views/list/columns. Also I was to able to fetch the correct data for the column by overlaying - /libs/dam/gui/coral/components/admin/collections/contentrenderer/collectionrow/collectionrow.jsp

The major issue I am facing is how to add a sorting for this column. I tried to do so using sortDir and sortName for the datasource in list view, but doesn't work. Also the datasource for its view refers to a shell node which is not present. Has anyone done this type of sorting? Any help is appreciated. Thank you in advance.

Attached screeshot below-

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Nupur_Jain

Hi @meghanagogate 

 

I tried to debug something on this and what I was able to find out that, on click on sorting as you stated, there is a call to 

 
This call renmder the jsp /libs/granite/ui/components/coral/foundation/table/table.jsp as on path  /lib/dam/gui/content/collections/jcr:content/views/list and there it has sling:resourceType property to granite/ui/components/coral/foundation/table
 
Now, you can read this JSP further to understand how is it utilizing sorting parameters to return sorted list.
 
I have not got chance to look into it further.
Hope it helps.
Thanks
Nupur
 

3 replies

TarunKumar
Community Advisor
Community Advisor
June 12, 2024

Hi @meghanagogate ,

You can try to write your own custom servlet which on button click will get triggered via Ajax call.
In you servlet you can write your ordering query. The button will have options of asc, desc, for button control you can take reference of "<localhost:port>assets.html/content/dam" console, where in top left you would see button with the name sort by. This option comes for both card and column view in DAM asset console.

 




-Tarun



Nupur_Jain
Adobe Employee
Nupur_JainAdobe EmployeeAccepted solution
Adobe Employee
June 13, 2024

Hi @meghanagogate 

 

I tried to debug something on this and what I was able to find out that, on click on sorting as you stated, there is a call to 

 
This call renmder the jsp /libs/granite/ui/components/coral/foundation/table/table.jsp as on path  /lib/dam/gui/content/collections/jcr:content/views/list and there it has sling:resourceType property to granite/ui/components/coral/foundation/table
 
Now, you can read this JSP further to understand how is it utilizing sorting parameters to return sorted list.
 
I have not got chance to look into it further.
Hope it helps.
Thanks
Nupur
 
kautuk_sahni
Community Manager
Community Manager
June 19, 2024

@meghanagogate Did you find the suggestion helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!

Kautuk Sahni