Adding a URI Column to the Listview using Tridion DataExtendersPosted by in GUI Extension | Tridion
Adding a new column to the Listview in Tridion 2011 is easy with using Data Extenders. With a few simple config changes we can add the TCM URI column to our default view – no code needed! In this article I will explain how to add the URI column as well as give some debugging tips.
The Tridion Listview can be extended using DataExtenders. The idea is that the config file for the extender specifies an XPath expression and matches some data in the GUI Response. We are lucky that the URI is part of the default GUI response and we simply need a little XSLT and config to show it. However, we can also add new data to the GUI Response is by extending the DataExtender class in .NET. I do not cover that here but there is an example in the Tridion LiveDocs.
1. Create a new GUI Extension – but only providing our config file since the URI is part of the default GUI Response
2. Add our new extension location to the System.config folder.
Steps for Adding the ListViewTCM Extension
1. Create a new folder under Tridion\Web\WebUI\Editors\ called ‘ListViewTcm’
2. Copy the extension config file below there. The important part in this code is the selector. It is doing an XPath match on the XML the Gui response is sending and selecting the ID attribute. We are lucky the ID is part of the response. Otherwise, we would extend the DataExtender class in .NET and is something I do not cover here.
<ext:columns> <column xmlns="http://www.sdltridion.com/2009/GUI/extensions/List "id="MyColumnID" type="data" title="URI" selector="@ID" translate="String" /> </ext:columns>
Whole config file:
3. Update the System.config to let it know about our new GUI “Extension”.
<editor name="ListViewTcm"> <installpath>C:\Program Files (x86)\Tridion\web\WebUI\Editors\ListViewTcm\ </installpath> <configuration>ListViewTcm.config</configuration> <vdir/> </editor>
4. Refresh the GUI and marvel at your new URI List column. I know I was delighted and surprised when I first saw it.
Mostly useful when you start building your own DataExtenders to put more info in the Response. Not used here though, since URI is already part of our response:
1. Enable debug output for the GUI
System.config, <client debug=”true”>
2. Enable GUI debugging in the Browser
3. View the Tridion.Web.Trace file in the WebUI/WebRoot folder. This is mostly used when debugging the .NET DataExtenders and something not covered here. Check if your extension is listed. This means the config is good and the GUI is trying to load it. When it does, you will see this message. This is good output: “Executing request-extension : ‘ListViewTcm’”. This is bad and most likely due to wrong Namespace / Class: “Configured dataextender ‘AddSchemaTitle, ListViewTcm’ can not be created, check .Net’s fusion log for more information”
Great job to the Tridion GUI Team for giving us the power over the Listview and ability to add columns. This extra information will save countless hours when searching for that extra piece of information and not having to open the item (or mouseover) to find it. The new column gets sorting and filtering for free and behaves just like the other columns. Overall I cannot wait to play more with this new and powerful feature.