Example Code:
<CustomAction ControlAssembly="CustomProject.Actions"
ControlClass="CustomProject.Actions"
ControlSrc="/_layouts/test/testPage.aspx"
Description="This is my custom action"
GroupId="MyCustomActions"
Id="f5bcd75e-23b9-4623-9a82-41cc7ceb10a6"
RegistrationId="MyMagicalList"
RegistrationType="List"
RequireSiteAdministrator="false"
Rights="AddListItems"
Sequence="1"
ShowInReadOnlyContentTypes="false"
ShowInSealedContentTypes="false"
Title="MyCustomAction">
EnabledScript parameter in CommandUIHandler, where you can put javascript code and check if specific page/list/view is loaded.
Example:
<CommandUIHandler
Command="Ribbon.ListItem.CustomGroup.Controls.BtnSayHello.Command"
CommandAction="javascript:alert('Image ');"
EnabledScript="javascript:
function isEnable(){
if(location.href.indexOf('AllItems.aspx') > 0){
return true;
}
return false;
}
isEnable();"
/>
<CustomAction ControlAssembly="CustomProject.Actions"
ControlClass="CustomProject.Actions"
ControlSrc="/_layouts/test/testPage.aspx"
Description="This is my custom action"
GroupId="MyCustomActions"
Id="f5bcd75e-23b9-4623-9a82-41cc7ceb10a6"
RegistrationId="MyMagicalList"
RegistrationType="List"
RequireSiteAdministrator="false"
Rights="AddListItems"
Sequence="1"
ShowInReadOnlyContentTypes="false"
ShowInSealedContentTypes="false"
Title="MyCustomAction">
EnabledScript parameter in CommandUIHandler, where you can put javascript code and check if specific page/list/view is loaded.
Example:
<CommandUIHandler
Command="Ribbon.ListItem.CustomGroup.Controls.BtnSayHello.Command"
CommandAction="javascript:alert('Image ');"
EnabledScript="javascript:
function isEnable(){
if(location.href.indexOf('AllItems.aspx') > 0){
return true;
}
return false;
}
isEnable();"
/>
No comments:
Post a Comment