In the use of SharePoint, we often need to customize a series of SharePoint menus, including the ECB menu. Below, we will briefly understand how the ECB menu is customized and how it works.
1. Normally, the ECB menu of the document library is as follows:
2. Copy the following JavaScript code and add references to the page.
<script src="/_layouts/15/CORE2.JS" type="text/javascript"></script>
3. Hide View/Edit attributes;
The effect is as follows:
4. Hide a Workflow
Results:
5. Hide Version Control
AddVersionsMenuItem(c, a, g);
The effect is as follows:
6. Hide the check-out and release of the main version
AddCheckinCheckoutMenuItem(c, a, g);
The effect is as follows:
7. Hide the Downloaded copy
Results:
8. Hide the delete menu
Results:
9. Modify the ECB menu Template
Copy a callout. js file and reference it on the page to be modified. The path is also under layouts;
Modify the default template of the body part;
Modify the default footer template;
Results:
Summary
In fact, the menu of SharePoint ECB can be modified in a variety of ways. You can use feature to activate XML, you can use designer to directly add, you can use JavaScript, the default JS script is modified in this article. Remember to copy the modification and do not change the original one. Otherwise, the global effect will be affected.
If you want to modify other SharePoint JS files, try F12 debugging, find related methods, and try again. Well, here we are.
Appendix
How to: Hide menu items in ECB for Sharepoint list items
SharePoint 2013 custom extension menu (1)
SharePoint 2013 custom extended menu (2)
Add ECB menu for Sharepoint
SharePoint 2013 operating document library ECB menu