Wednesday, April 1, 2009

Hide sharepoint Contextmenu(ECB)/ Remove sharepoint Contextmenu(ECB)

Core.Js findings:

  1. In Core.Js, under path C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033

function AddSharedNamespaceMenuItems creates following context menu items.

View Item,

Edit Item,

Manage Permissions

You can override the functions in MasterPage to modify the context menu.

  1. To Hide context Menu in sharepoint. Override following function of core.js.

    AddListMenuItems -- Hides Context Menu from list.


 

For more details mail me at indrajitk@gmail.com


 

Steps to hide Context menu for list items:


 

1. Just go to core.js file(C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033)

2. find AddListMenuItems function.

3. You will find following code in this function, if (typeof(Custom_AddListMenuItems) !="undefined") { if (Custom_AddListMenuItems(m, ctx)) return; }

4. You can override AddListMenuItems function by Implementing Custom_AddListMenuItems(m, ctx) function in any global place(I did it in master page.). Do not put any code in this function except return false True;

5. No context menu will be displayed for list items.

No comments: