Goal
Add title column (available in Digital Assets tab ootb) to the search grid of Classic UI Damadmin - http://localhost:4502/damadmin
For adding a column to siteadmin search panel check this post
For adding a column to Digital Assets tab grid check this post
Demo | Package Install
Solution
1) Login to CRXDE Lite, create folder (nt:folder) /apps/classicui-damadmin-search-title-column
2) Create clientlib (type cq:ClientLibraryFolder) /apps/classicui-damadmin-search-title-column/clientlib and set property categories of String type to cq.widgets
3) Create file ( type nt:file ) /apps/classicui-damadmin-search-title-column/clientlib/js.txt, add the following
title-column.js
4) Create file ( type nt:file ) /apps/classicui-damadmin-search-title-column/clientlib/title-column.js, add the following code
(function(){ if(window.location.pathname !== "/damadmin"){ return; } // yes cq-siteadminsearchpanel-grid is dam search panel grid in /damadmin var DA_GRID = "cq-siteadminsearchpanel-grid", TITLE = "title"; var DA_INTERVAL = setInterval(function(){ var grid = CQ.Ext.getCmp(DA_GRID); if(grid && (grid.rendered == true)){ clearInterval(DA_INTERVAL); addTitleColumn(grid); } }, 250); function addTitleColumn(grid) { var cm = grid.getColumnModel(); var tColumn = new CQ.Ext.grid.Column({ "header": "Title", "id": TITLE, width: 100, "renderer": function (v, params, record) { if(!record || !record.json || !record.json["jcr:content"]){ return ""; } var metadata = record.json["jcr:content"]["metadata"]; if(metadata){ return metadata["dc:title"]; } } }); cm.columns.splice(2, 0, tColumn); cm.lookup[TITLE] = tColumn; } })();
No comments:
Post a Comment