The user button on the user tab is always disabled (ribbon bar)

I found many examples of how to add a custom tab with custom controls on the ribbon bar. But no one works for me. I got a custom tab, but the button is always disabled. There is my current version of the code:

<?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> 

I cleared the cache. I read about the importance of the EnabledScripts attribute in CommandUIHandler. But I always have the same result:

Disabled button

Does anyone have the same problem? Please, help!

+4
source share
2 answers

I checked the local user action my, and EnabledScript followed a different pattern:

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

If your item is displayed but always disabled, I'm sure where the problem is.

I think the attribute is optional, if I remember.

+3
source

I had the same problem, I'm not sure if this is a suitable solution, I'm new. I deleted the item from the function for which the "Site" area was selected, another function was added, the "Web" area was set, my button in this function was added, saved, expanded, a new function from the site functions was turned on, and it worked .

+3
source

Source: https://habr.com/ru/post/1501310/


All Articles