lundi 2 février 2015

Get object of ribbon button in JavaScript



I am trying to access the ribbon button via JavaScript. Below is my code:



// Get the page manager
var ribbonPageMgr = SP.Ribbon.PageManager.get_instance();
// Get the ribbon
var ribbon = ribbonPageMgr.get_ribbon();

// Get the tab in which button resides
var ribbonTab = ribbon.getChild("Ribbon.List"); // CUI.Tab
// Get the group in tab in which button resides
var ribbonGroup = ribbonTab.getChild("Ribbon.List.Settings"); // CUI.Group


In my case the ribbon button resides in the "List" tab under the "Settings" group. But I am stuck after this point. From whatever resources I could find on the web I have come to conclusion that a ribbon button resides in following containers:



CUI.Tab --> CUI.Group --> CUI.Layout --> CUI.Section



How do I proceed to find CUI.Layout, CUI.Section and eventually my ribbon button? Is this the correct way that I am following?








0 commentaires:

Enregistrer un commentaire