4

How can I get a list of WhereUsed with the Tridion Anguilla Framework? I am adding an extra tab in my Component Edit window and want to shw the Used iems in the tab.

Here is my code:

console.log('before where used');
var filter = new Tridion.ContentManager.ListFilter();
filter.columns = $const.ColumnFilter.DEFAULT;
filter.conditions.InclLocalCopies = true;                       
console.log(filter);        
var list = tridion.Web.UI.ContentManager.WhereUsed.GetListUsingItems(    
    "tcm:175-279165-16",     
    filter,   
    filter.columns, //Tridion.Constants.ColumnFilter.DEFAULT,
    new function() { 
        console.log(arguments); 
    },     
    new function() { 
        console.log(arguments); 
    }   
);    
console.log('after');

And the Firebug output:

before where used
item.a...-279165 (line 663)
ListFilter { prototypeMembers={...}, interfaces={...}, properties={...}, more...}
item.a...-279165 (line 668)
[]
item.a...-279165 (line 674)
[]

The arrays of the results are empty.

6

Robert,

You got it almost right... The way you can get the "where used" list is as follows:

//Get the item:
$item = $models.getItem("tcm:27-2899");

//Define a filter:
$filter = new Tridion.ContentManager.ListFilter();
$filter.columns = $const.ColumnFilter.DEFAULT;
$filter.conditions.InclLocalCopies = true;      

//Get the list:
$list = $item.getListUsingItems($filter, false, false);

//Load the list (this is the most important step, otherwise, the list will remain empty)
$list.load(true);

//Get the xml or the xml document
$list.getXml();
$list.getXmlDocument();

Note: You might have to add a listener (event handler) when you "load" the list to make sure you "wait" for the list to be loaded prior to use its contents.

  • Thanks Jamie - works well. I might need the event handler, though, will test some more. – robrtc Dec 4 '13 at 15:25
  • @robrtc you definitely need the load event handler, only time you don't need it is when this list is already in the cache. – Bart Koopman Dec 4 '13 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.