Sharepoint “自定义”选项卡上的“自定义”按钮始终处于禁用状态(功能区栏)
我发现了很多示例,介绍了如何在功能区栏上添加带有自定义控件的自定义选项卡。但是没有人为我工作。我有自定义选项卡,但按钮始终处于禁用状态。 下面是我当前的代码版本:Sharepoint “自定义”选项卡上的“自定义”按钮始终处于禁用状态(功能区栏),sharepoint,sharepoint-2010,ribbon,Sharepoint,Sharepoint 2010,Ribbon,我发现了很多示例,介绍了如何在功能区栏上添加带有自定义控件的自定义选项卡。但是没有人为我工作。我有自定义选项卡,但按钮始终处于禁用状态。 下面是我当前的代码版本: <?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <CustomAction Id="CustomRibbonTab" Location=
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="CustomRibbonTab"
Location="CommandUI.Ribbon"
RegistrationId="101"
RegistrationType="List">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location="Ribbon.Tabs._children">
<Tab
Id="Ribbon.CustomTab"
Title="Custom Tab"
Description="Custom Tab !!!"
Sequence="701">
<Scaling
Id="Ribbon.CustomTab.Scaling">
<MaxSize
Id="Ribbon.CustomTab.MaxSize"
GroupId="Ribbon.CustomTab.CustomGroup"
Size="OneLargeTwoMedium"/>
<Scale
Id="Ribbon.CustomTab.Scaling.CustomTabScaling"
GroupId="Ribbon.CustomTab.CustomGroup"
Size="OneLargeTwoMedium" />
</Scaling>
<Groups Id="Ribbon.CustomTab.Groups">
<Group
Id="Ribbon.CustomTab.CustomGroup"
Description="Custom Group!"
Title="Custom Group"
Sequence="62"
Template="Ribbon.Templates.CustomTemplate">
<Controls Id="Ribbon.CustomTab.CustomGroup.Controls">
<Button
Id="Ribbon.CustomTab.CustomGroup.CustomButton"
Command="CustomTab.CustomButtonCommand"
Sequence="115"
Description=""
LabelText="Custom Button"
Image32by32="/_layouts/images/PPEOPLE.GIF"
TemplateAlias="cust1"/>
</Controls>
</Group>
</Groups>
</Tab>
</CommandUIDefinition>
<CommandUIDefinition Location="Ribbon.Templates._children">
<GroupTemplate Id="Ribbon.Templates.CustomTemplate">
<Layout
Title="OneLargeTwoMedium"
LayoutTitle="OneLargeTwoMedium">
<Section Alignment="Top" Type="OneRow">
<Row>
<ControlRef DisplayMode="Large" TemplateAlias="cust1" />
</Row>
</Section>
</Layout>
</GroupTemplate>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="CustomTab.CustomButtonCommand"
CommandAction="javascript:alert('Hello, world!');"
EnabledScript="javascript:return true;"/>
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
</Elements>
我清理了缓存。我阅读了CommandUIHandler中enabledScript属性的重要性。但我总是得到同样的结果:
有人有同样的问题吗?请帮忙 我签出了我的一个本地自定义操作,而EnabledScript遵循了不同的模式:
EnabledScript="javascript:function JustReturnTrue()
{
return true
}
JustReturnTrue();"
如果您的项目显示,但始终禁用,我打赌这就是问题所在
如果我记得的话,我认为这个属性是可选的。我也有同样的问题,我不确定这是否是正确的解决方案,我是个新手。我从功能中删除了作用域设置为“站点”的元素,添加了另一个功能,将作用域设置为“Web”,在此功能中添加了我的按钮项,保存、部署并启用了“站点功能”中的新功能,该功能正常工作。感谢您的回复,但没有帮助。我的问题与SP2013相同。你能解决它吗?@vk_muse,尝试清理缓存并进行硬加载。据我记忆所及,它帮助了我。