I found how Anguilla takes care of this. When you implement the Data Extender, you expand the information about the elements displayed in the list, which basically means that you expand the data (model) behind the element in question.
Each element in Tridion has its own class in the Anguilla platform, for example, the component has its own javascript class Tridion.ContentManager.Component.
Having said that, and return to the example that shows the name of the component schema, we do not actually extend the model, since this information is already available in the component. However, we need to rewrite the methods that are open to each information used to display the lists in which the item is located, in this case the Component.
So, when we are dealing with Data Extender, if we want to fully implement this functionality, we need not only to define a data extender:
<ext:dataextender name="IntelligentDataExtender" type="Com.Tridion.PS.Extensions.IntelligentDataExtender,PS.GUI.Extensions"> <ext:description>Shows extra info</ext:description> </ext:dataextender>
But also we need to determine which column we are adding:
<ext:lists> <ext:add> <ext:extension name="IntelligentColumnExtender" assignid="IntelligentDataColumnExtender"> <ext:listDefinition> <ext:selectornamespaces/> <ext:columns> <column xmlns="http://www.sdltridion.com/2009/GUI/extensions/List" id="IntelligentData" type="data" title="Additional Info" selector="@ExtendedInfo" translate="String"/> </ext:columns> </ext:listDefinition> <ext:apply> <ext:view name="DashboardView" /> </ext:apply> </ext:extension> </ext:add> </ext:lists>
After that, the GUI will display the newly added column: "Additional Information"
Well, now we need to get the list updated when the item is edited / checked out and turned on, etc.
To do this, we need to expand the model and implement several methods in the object that we are expanding. In this example, I am expanding the Page object, so whenever a page is edited, the line in the list that we want to update is updated along with the rest of the cells in the table.
To extend the model, we need to determine what types we extend, in this example I am going to use the "Page" class as an example. First of all, you need to define the model extension in the configuration file of your editor:
<cfg:group name="Com.Tridion.PS.Extensions.UI.Model" merger="Tridion.Web.UI.Core.Configuration.Resources.DomainModelProcessor" merge="always"> <cfg:domainmodel name="Com.Tridion.PS.Extensions.UI.Model"> <cfg:fileset> <cfg:file type="script">/Scripts/PSPage.js</cfg:file> </cfg:fileset> <cfg:services /> </cfg:domainmodel> </cfg:group>
and
<ext:modelextensions> <cfg:itemtypes> <cfg:itemtype id="tcm:64" implementation="Com.Tridion.PS.Extensions.UI.PSPage" /> </cfg:itemtypes> </ext:modelextensions>
As you can see, I am expanding the page using the class "Com.Tridion.PS.Extensions.UI.PSPage", which is defined in the Javascript file "/Scripts/PSPage.js".
The only method that handles updating the string is the following:
Com.Tridion.PS.Extensions.UI.PSPage.prototype.getListItemXmlAttributes = function PSPage$getListItemXmlAttributes(customAttributes) { var attribs = {}; var p = this.properties; if (customAttributes) { for (var attr in customAttributes) { attribs[attr] = customAttributes[attr]; } }
As you can see, I am implementing the βExtendedInfoβ attribute, which is displayed in my extra column.
There's more than just adding a Data Extender when working with adding a column to our lists. I will write a post on my blog here to provide a fully working example.
Hope this makes sense.