Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

Trying to implement sorting for custom column in collections list view

Avatar

Level 1

Hi All,

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

Screenshot 2024-06-12 at 11.29.52 AM.png

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-

Screenshot 2024-06-12 at 11.43.22 AM.png

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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
 

View solution in original post

3 Replies

Avatar

Community Advisor

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.

TarunKumar_0-1718185356522.png

 




-Tarun



Avatar

Correct answer by
Community Advisor

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
 

Avatar

Administrator

@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