How to GetLocalizedItems using the Tridion Anguilla Framework?

I would like to use the GetLocalizedItems method in the Anguilla platform.

I do not know how to create a new filter and establish conditions or what to use for success and failure.

In the GUI:

tridion.Web.UI.ContentManager.WhereUsed.GetListUsedItems(id, filter.conditions, filter.columns, success, failure); 

Are the methods in this namespace used by our extensions?

+4
source share
1 answer

Filter construction

Here is an example of creating a filter

 var filter = new Tridion.ContentManager.ListFilter(); filter.conditions.ItemTypes = 16 | 2; // folders and components filter.conditions.Recursive = true; filter.conditions.BasedOnSchema = "tcm:1-23-8,tcm:1-32-8".split(","); filter.columns = Tridion.Constants.ColumnFilter.DEFAULT; 

Or this extremely simple case from General.js:

 var templateFilter = new Tridion.ContentManager.ListFilter({ conditions: { ItemTypes: [ itemType ] } }); 

WCF method call

The second part of your question has indeed been addressed at fooobar.com/questions/770785 / ... , although I will make it more specific here.

WCF / AJAX calls, for example, run asynchronously, as they can take some time. Although you usually just process the result of the call in a line after the closing parenthesis, you cannot do this in AJAX calls, since this line will be executed before the function completes. Instead, you need to pass one or more callback functions that are called after the function completes.

Usually I just pass two functions that burst into my browser’s JavaScript JavaScript debugger when I first started figuring out such a method:

 Tridion.Web.UI.ContentManager.WhereUsed.GetListUsedItems( "tcm:1-23", filter.conditions, filter.columns, new function() { console.log(arguments); debugger; }, new function() { console.log(arguments); debugger; } ); 

So, the first (anonymous) function is called when the (asynchronous) HTTP request to the TCM server was successfully executed, and the second is called when the call failed. In the answer above, we named them onSuccess and onFailure to make their nature more explicit.

In this case, both functions simply write the implicit arguments parameter, which is always passed in JavaScript. Then they go into your browser's JavaScript debugger, so you can additionally view the arguments.

+5
source

All Articles