Goal
Add Custom metadata columns in List view of Assets Console - http://localhost:4502/assets.html/
This post adds columns using server side rendering, for adding columns using client side logic check this post
For Custom metadata columns in Search Console check this post
Demo | Package Install | Github
Configure Columns
Columns in List View
Solution
1) Add the custom metadata columns configuration in /apps/dam/gui/content/commons/availablecolumns (Sling Resource Merger combines the otb columns in /libs/dam/gui/content/commons/availablecolumns with ones configured in /apps)
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured">
<eaemTitle
jcr:primaryType="nt:unstructured"
jcr:title="EAEM Title"
columnGroup="Experience AEM"
configurable="{Boolean}true"
default="{Boolean}true"/>
<eaemDesc
jcr:primaryType="nt:unstructured"
jcr:title="EAEM Description"
columnGroup="Experience AEM"
configurable="{Boolean}true"
default="{Boolean}true"/>
<eaemKeywords
jcr:primaryType="nt:unstructured"
jcr:title="EAEM Keywords"
columnGroup="Experience AEM"
configurable="{Boolean}true"
default="{Boolean}true"/>
</jcr:root>
2) Add the following code for rendering metadata values in /apps/dam/gui/coral/components/admin/contentrenderer/row/common/reorder.jsp; include the otb reorder.jsp using cq:include
<%@include file="/libs/granite/ui/global.jsp"%>
<%@ page import="org.apache.sling.api.resource.ValueMap" %>
<%@ page import="org.apache.sling.api.resource.Resource" %>
<%@taglib prefix="cq" uri="http://www.day.com/taglibs/cq/1.0"%>
<%
final String ASSET_RES_TYPE = "dam/gui/coral/components/admin/contentrenderer/row/asset";
Resource assetResource = resource;
String eaemTitle = "", eaemDesc = "", eaemKeywords = "";
if(assetResource.getResourceType().equals(ASSET_RES_TYPE)){
ValueMap vm = assetResource.getChild("jcr:content/metadata").getValueMap();
eaemTitle = (String)vm.get("eaemTitle", "");
eaemDesc = (String)vm.get("eaemDesc", "");
eaemKeywords = (String)vm.get("eaemKeywords", "");
}
%>
<td is="coral-table-cell" value="<%= eaemTitle %>">
<%= eaemTitle %>
</td>
<td is="coral-table-cell" value="<%= eaemDesc %>">
<%= eaemDesc %>
</td>
<td is="coral-table-cell" value="<%= eaemKeywords %>">
<%= eaemKeywords %>
</td>
<cq:include script = "/libs/dam/gui/coral/components/admin/contentrenderer/row/common/reorder.jsp"/>


Hi Sreekanth,
ReplyDeleteI'm also developing similar feature in my project where I want to add sorting feature in card view by Title.
Do you have any recommendations/reference link to implement this feature?
Thanks,
Anil
i believe you can handle this sort server side https://experience-aem.blogspot.com/2018/11/aem-6420-add-sort-by-name-type-in-assets-list-view-default-sort-name.html
DeleteHi Sreekanth,
ReplyDeleteThanks for article it's a great help!
I am also developing a similar column. In the AEM environemnt I am working, there is already an reorder.jsp present in the same location. It comes from "AEM Guides(UUID)" package. It shows UUID column.
I am trying to see if there is a way to see if both could co-exist. What;s happening currently is my "reorder.jsp" replaces the existing one, and data for my column is shown the UUID column from the AEM Guides package.
Any suggestions would be super helpful.