Hi Team,
I need to add download button directly on context menu, please help
I tried the following code
SP.SOD.executeFunc("callout.js", "Callout", function() {
var itemCtx = {};
itemCtx.Templates = {};
itemCtx.BaseViewID = 'Callout';
//The template type of 101 is a document library
itemCtx.ListTemplateType = 101;
itemCtx.Templates.Footer = function(itemCtx) {
//Override the footer of the hover card with your custom function.
return CalloutRenderFooterTemplate(itemCtx, AddCustomAction, true);
};
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(itemCtx);
});
function AddCustomAction(renderCtx, calloutActionMenu) {
//Action you want to add to the footer
calloutActionMenu.addAction(new CalloutAction({
text: "View Properties",
tooltip: 'View the properties of this document',
onClickCallback: function() {
//Determine the source of the list so you can navigate back to it.
var listSource = _spPageContextInfo.serverRequestPath;
//Make sure to append the ID to the URL so the item renders properly.
window.location = renderCtx.displayFormUrl + "&ID=" + renderCtx.CurrentItem.ID + "&Source=" + listSource;
}
}))
calloutActionMenu.addAction(new CalloutAction({
text: "Edit Properties",
tooltip: 'Edit the properties of this document',
onClickCallback: function() {
//Determine the source of the list so you can navigate back to it.
var listSource = _spPageContextInfo.serverRequestPath;
window.location = renderCtx.editFormUrl + "&ID=" + renderCtx.CurrentItem.ID + "&Source=" + listSource;
}
}));
//Display the default document library actions
CalloutOnPostRenderTemplate(renderCtx, calloutActionMenu);
} This works like a charm, but I am unable to figure out the code to download a copy in call back function
calloutActionMenu.addAction(new CalloutAction({
text: "Download",
tooltip: 'Download document',
onClickCallback: function() {
//what code to call here ???
}
}));Please let me know how to handle this scenario
Thanks in Advance, Jiniv Thakkar