0

I have a custom button created in the ribbon of tridion.

If an item either Component/Page has been selected i need to get the info whether the item is localized or not. Based on that custom button will be enabled/disabled.

For getting the tcmid of the selected component/page i am currently writing as

selection.getItem(0); in my javascript.

Similarly, how can i get the localized info of the selected item(Component/Page)

pavan
  • 451
  • 1
  • 5
  • 16

2 Answers2

3

The Properties and Methods of the UI JavaScript Objects can be found in the SDL Tridion 2011 SP1 GUI Extension API documentation which you can find on http://docportal.sdl.com/sdltridion

Just check in the Tridion.ContentManager Namespace and you will find things like Component.getInfo() and Component.getBlueprintHierarchy() from which you can extract this kind of information.

Bart Koopman
  • 4,835
  • 17
  • 30
  • Shouldn't the `isLocalized` provide that information directly? – Ram G Jul 27 '12 at 18:11
  • I have tried selection.isLocalized and selection.getItem.isLocalized; but both of them are returning undefined on component/page selection – pavan Jul 28 '12 at 05:56
  • 1
    @Bart, what, a new documentation site? Oh wait, it's TridionWorld. – Alvin Reyes Jul 28 '12 at 08:11
  • I have gone through the API's. I didnt find exactly the one which returns whether the item is localized or not on selection. Is there any other way(indirect) to identify whether the selected item is localized or not. Could you please suggest me. – pavan Jul 30 '12 at 11:53
2

Just check the isLocalized method of the item:

var itemUri = selection.getItem(0);
var item = $models.getItem(itemUri);
if (item.isLocalized())
{
   // Do your magic here
}

I've left out the error handling and potential loading of the item, for simplicity.

Peter Kjaer
  • 4,316
  • 13
  • 23