Adding ECB menu to document libraries
-
05-10-2020 - |
Question
I am trying to add custom action to ECB menu but it is not working. Below is my code:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
ScriptBlock="function AddCustom(IDItem,IDList){
var options = {
title: 'This is the title of the page',
width: 600,
height: 600,
dialogReturnValueCallback: RefreshOnDialogClose,
showClose:true,
url: '~site/_Layouts/Custom/ApplicationPage.aspx?Id=
{IDItem}&ListId={IDList}'
};
SP.UI.ModalDialog.showModalDialog(options);
}"
Location="ScriptLink">
</CustomAction>
<CustomAction
Id="CA_WF_Init"
RegistrationType="List"
RegistrationId="101"
Location="EditControlBlock"
Sequence="301"
Title="My Custom ECB Menu Item" >
<UrlAction
Url="javascript:AddCustom({ItemId},{ListId});"/>
</CustomAction>
</Elements>
If i remove the {ListId} parameter then its working properly. Can someone help me to find out what am i missing or doing wrong?
Thanks
La solution
{ListId}
is a GUID, i.e. a string (while {ItemId}
is an integer). You should probably use quotes arround this parameter:
<UrlAction
Url="javascript:AddCustom({ItemId},'{ListId}');"/>
Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange