SDL Tridion GetListKeywords using Anquilla Framework

I am writing a GUI extension and using the Anquilla structure to get a list of Keywords in Category . I get an XML document for a list of keywords, and then work with this document in my extension.

My problem is that the returned XML does not contain the value of the Description keyword. I have a title and key, etc.

My source code is as follows:

 var category = $models.getItem("CATEGORYTCMID:); var list = category.getListKeywords(); list.getXml(); 

A typical node is returned:

 <tcm:Item ID="tcm:4-1749-1024" Type="1024" Title="rate_one" Lock="0" IsRoot="true" Modified="2012-12-17T23:01:59" FromPub="010 Schema" Key="rate_one_value" IsAbstract="false" CategoryTitle="TagSelector" CategoryID="tcm:4-469-512" Icon="T1024L0P0" Allow="268560384" Deny="96" IsNew="false" Managed="1024"/></tcm:ListKeywords> 

So, I tried using a filter to give me additional information about the columns:

 var filter = new Tridion.ContentManager.ListFilter(); filter.columns = Tridion.Constants.ColumnFilter.EXTENDED; var list = category.getListKeywords(filter); 

Unfortunately, this gives additional XML attributes:

 IsShared="true" IsLocalized="false" 

I would really like the description to be part of this XML without creating a Keyword object from XML. Is it possible?

cough any ideas? cough

+8
tridion tridion-2011
source share
3 answers

I am afraid that you will have to download the keyword to get a description. It is not used in any lists, so it is not returned in XML.

+3
source share

You can always create a List Extender to add this information to the list, but try to be smart, because this expander will be executed every time GetList is called.

It does not save you having to open every keyword in the list, but you will do it on the server side (for example, with Core Service / NetTcp), which will probably be easier and faster than opening every keyword with Anguilla.

+2
source share

Thanks for answers. In this case, I need only one keyword, so I just get it from the CMS. Getting an object in Anguilla is a bit strange, here is the code in case someone is interested:

1) In your main area of ​​code:

  var selectedKy = $models.getItem("TcmUriOfKeywordHere"); if (selectedKy.isLoaded()) { p.selectedKy = selectedKy; this.onselectedKyLoaded(); } else { $evt.addEventHandler(selectedKy, "load", this.onselectedKyLoaded); selectedKy.load(); } 

It is worth noting how I store the keyword in the properties of the element, so I can get it in the onselectedKyLoaded function

2) Function called after loading an element

 ContentBloom.ExampleGuiExtension.prototype.onselectedKyLoaded = function (event) { var p = this.properties; var selectedDescription = p.selectedKy.getDescription(); // do what you need to do with the description :) }; 

I solved this, thanks to the answer here: https://stackoverflow.com/a/166778/- Cheers Nuno :)

0
source share

All Articles