Tuesday, 14 February 2012

Ribbon Tab Behaviour

Realised that when I use the following CustomAction,


<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Id="Chapter3.CustomTab" Location="CommandUI.Ribbon" RegistrationType="List" RegistrationId ="101">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Tabs._children">
<Tab Id="Chapter3.CustomTab" Title="Chapter3" Description="Demo tab for Chapter 3" Sequence="501">
<Scaling Id="Chapter3.CustomTab.Scaling">
<MaxSize Id="Chapter3.FirstDemoGroup.MaxSize"
GroupId="Chapter3.FirstDemoGroup"
Size="OneLarge"/>
<Scale Id="Chapter3.FirstDemoGroup.Scaling.CustomTabScaling"
GroupId="Chapter3.FirstDemoGroup"
Size="OneMedium" />
</Scaling>
<Groups Id="Chapter3.Groups">
<Group Id="Chapter3.FirstDemoGroup"
Description="Contains demo controls"
Title="Demo Group"
Sequence="52"
Template="Ribbon.Templates.SingleButton">
<Controls Id="Chapter3.FirstDemoGroup.Controls">
<Button Id="Chapter3.FirstDemoGroup.HelloWorld"
Command="Chapter3.HelloWorldCommand"
Sequence="15"
Image16by16="/_layouts/images/NoteBoard_16x16.png"
Image32by32="/_layouts/images/NoteBoard_32x32.png"
Description="Display a hello world msg"
LabelText="Hi World"
TemplateAlias="c1"
/>
</Controls>
</Group>
</Groups>
</Tab>
</CommandUIDefinition>
<CommandUIDefinition Location="Ribbon.Templates._children">
<GroupTemplate Id="Ribbon.Templates.SingleButton">
<Layout Title="OneLarge" LayoutTitle="OneLarge">
<Section Alignment="Top" Type="OneRow">
<Row>
<ControlRef DisplayMode="Large" TemplateAlias="c1"/>
</Row>
</Section>
</Layout>
<Layout Title="OneMedium" LayoutTitle="OneMedium">
<Section Alignment="Top" Type="OneRow">
<Row>
<ControlRef DisplayMode="Medium" TemplateAlias="c1"/>
</Row>
</Section>
</Layout>
</GroupTemplate>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command="Chapter3.HelloWorldCommand"
CommandAction="javascript:
var notificationId = SP.UI.Notify.addNotification('Hello World');" />
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
</Elements>




And if you remove the CommandUIHandlers component, the tab will not appear!!!!!!!! Strange...

No comments:

Post a Comment