sharepoint – 自定义选项卡上的自定义按钮始终处于禁用状态(功能区栏)

我找到了很多示例,如何在功能区栏上添加带自定义控件的自定义选项卡.但没有人适合我.我有自定义选项卡,但始终禁用按钮.
有我当前版本的代码:

<?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中读到了EnabledScripts属性的重要性.但我总是有相同的结果:

有没有人有同样的问题?请帮忙!

最佳答案
我查看了我的本地自定义操作,EnabledScript遵循不同的模式:

EnabledScript="javascript:function JustReturnTrue()
{
      return true
}
JustReturnTrue();" 

如果您的项目显示但始终被禁用,我打赌这就是问题所在.

如果我记得的话,我认为该属性无论如何都是可选的.

转载注明原文:sharepoint – 自定义选项卡上的自定义按钮始终处于禁用状态(功能区栏) - 代码日志