Sunday, September 23, 2012

Select custom ribbon tab - jQuery

    I created custom ribbon tab and a button on a page. When  a user press the button on the page, I needed to focus him to the custom ribbon tab. Of course, I used 
_ribbonStartInit("Ribbon.CustomTab", false, null);

but the problem is, after a user changes it to another tab, i.e. "Read" or "Browse" the second pressing doesn't work. Therefore, the solution was - adding SelectRibbonTab() function:

$('img.CustomTabButtonClass').bind('click', function() { 
    
  if (typeof(_ribbonStartInit) == "function")
   {
     try 
     {
       _ribbonStartInit("Ribbon.CustomTab", false, null);
     }
     catch(e)
       {
                  
        }
     SelectRibbonTab("Ribbon.CustomTab", true);
    }
    });

No comments:

Post a Comment