I have created a simple Ribbon command that hides the header, footer, and ribbon via jQuery. It then calls window.print() and unhides the previously hidden divs. It works great on my development machine using IE9, and works everywhere using Chrome or Firefox. Unfortunately it does not work in IE8 in production. I tried reverting to IE8 to test but was unable to.
Can you think of anything that could cause my ribbon to be greyed out? My simple code can be found below:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="SharePoint.Ribbon.NewGroupInExistingTab"
Location="CommandUI.Ribbon">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Templates._children">
<GroupTemplate Id="Ribbon.Templates.NewGroupInExistingTab.OneLargeExample">
<Layout Title="NewGroupInExistingTabOneLarge" LayoutTitle="NewGroupInExistingTabOneLarge">
<Section Alignment="Top" Type="OneRow">
<Row>
<ControlRef DisplayMode="Large" TemplateAlias="Button1" />
</Row>
</Section>
</Layout>
</GroupTemplate>
</CommandUIDefinition>
<CommandUIDefinition Location="Ribbon.WikiPageTab.Scaling._children">
<MaxSize
Id="SharePoint.Ribbon.NewGroupInExistingTab.NotificationGroup.MaxSize"
Sequence="15"
GroupId="SharePoint.Ribbon.NewGroupInExistingTab.NotificationGroup"
Size="NewGroupInExistingTabOneLarge" />
</CommandUIDefinition>
<CommandUIDefinition Location="Ribbon.WikiPageTab.Groups._children">
<Group
Id="SharePoint.Ribbon.NewGroupInExistingTab.NotificationGroup"
Sequence="15"
Description="Print Page"
Title="Print"
Template="Ribbon.Templates.NewGroupInExistingTab.OneLargeExample">
<Controls Id="SharePoint.Ribbon.NewGroupInExistingTab.NotificationGroup.Controls">
<Button
Id="SharePoint.Ribbon.NewGroupInExistingTab.NotificationGroup.Print"
Command="NewGroupInExistingTab.Command.Print"
Sequence="10"
Image16by16="/_layouts/Redacted/Images/Print16.png"
Image32by32="_layouts/Redacted/Images/Print32.png"
Description="Print the current page."
LabelText="Print the current page"
TemplateAlias="Button1" />
</Controls>
</Group>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="NewGroupInExistingTab.Command.Print"
CommandAction="javascript:
$('div#s4-ribbonrow').hide();
$('div#Redacted-header').hide();
$('div#Redacted-footer').hide();
$('div#grid-gutter').css('margin','0');
$('div#Redacted-wrapper').css('margin','0');
window.print();
$('div#s4-ribbonrow').show();
$('div#Redacted-header').show();
$('div#Redacted-footer').show();
$('div#grid-gutter').css('margin','0 auto');
$('div#Redacted-wrapper').css('margin','0 auto');
"/>
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
</Elements>
$
withjQuery
or try addingEnabledScript="javascript:return true;"