1

I am trying to hide "Workflow" from ECB menu in a sharepoint 2013 List I added this code to allitems.aspx in the PlaceHolderPageDescription tag

<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js" type="text/javascript"></script>
<script src="//code.jquery.com//jquery-1.6.2.min.js" type="text/javascript"></script>
<script type="text/javascript">


$('.ms-MenuUIPopupBody').live('mouseover', function() { 

$('#ID_Workflows').parent().hide();
$('#ID_Workflows').remove();
});
</script>

the workflow item still exists in the ECB,what am i missing here?

2

I have an easy solution to this. Requirement is hiding the ECB context menu of the listItem. In my requirement I wanted to show only View,Edit,Delete options on hover of the listitem menu Sample List with ECB menu

I wanted to hide the 'Workflows', 'Compliance Details' and 'Shared With'. Answer is :

First click on the settings button ->EditPage->Add webpart->under Media and content->select script editor webpart(place the script editor below the list)->click on 'edit snippet'-> and copy the following code:

<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.1.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(hideECBMenuItem);
function hideECBMenuItem(){
//alert("jquery is working");
$("div.ms-list-itemLink").click(function(){
CoreInvoke('ShowECBMenuForTr', this, event);
MenuItemSetter(); return false;
});

$("a.ms-lstItmLinkAnchor").click(function(){
CoreInvoke('ShowECBMenuForTr', this, event);
MenuItemSetter(); return false;
});
}

function MenuItemSetter(){
setTimeout("WorkingWithMenuMenuItem()",300);
}

function WorkingWithMenuMenuItem(){
//give the names the Ecb menu items you want to hide
$("a[title='Workflows']").parent().hide();
$("a[title='Compliance Details']").parent().hide();
$("a[title='Shared With']").parent().hide();
}
</script>

Then click Page->'Stop editing'. And when you try to open the ECB context menu of the list item you find the required elements being hidden.

Hope this helps! :)

  • amazingly worked :) thanks!! just have those three lines in the answer, i feel that they are sufficient :) upvoted – Vignesh Subramanian Jun 24 '15 at 14:19
  • It works perfectly if list view don't have grouping. But in case of grouping it is not working. Could you please help me out in this case.... Thanks in advanced. – Rohit Waghela May 22 '16 at 8:59
2

The easiest way in my opinion is to use following CSS:

<style>
li.ms-core-menu-item[text="NAME OF THE ENTRY YOU WANT TO REMOVE"] 
{display: none !important;}
</style>
1

As far as I know, you cannot modify OOTB menu item in the ECB. This was true for Sharpeoint 2010, and I have not seen any documentation stating that this has changed in 2013. To get around this, copy the core.js file, and modify the ECB in that file. Then, on your site page, instead of using core.js, load your customecore.js file in it's place.

Here is a link to read more on this: Hide ECB Menu

Like I said, this was the issue in 2010, and I have not seen anything different for 2013.

  • Actually, looking at the comments in the website, it looks like this doen't work for 2013. I will try to find more information if I can. – Brandon C. Jun 30 '14 at 10:36
  • thank u for ur reply but i can't change the core.js i have multiple sites,this is needed only for one site – user30117 Jun 30 '14 at 11:09
0

Try the jQuery equivalent to this

   .ms-MenuUIULItem[text='Workflows']
    { 
      display:none !important;
    }
0

Here is the working solution -

Step 1 - Edit the Library Page and Add Script Editor Web Part(Always add script web part below document web part) .

Step 2 - Paste the Below Code in web part for hiding the required button from ECB Menu Item using the Button ID (Replace ID value after # ).

<style type="text/css">

li.ms-core-menu-item #ID_DeleteDocItem, .ms-core-menu-separator hr {

display:none;

}
</style>

Note -Button Id can be found by Opening Core.js file (use ctrl+F to find the required ID) using the name of Menu Item . For eg if you want to hide Delete option , paste Delete in ctrl+F and get the reqiured ID .

Path for Core.js file - C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS

Screen Shot : Hided CheckOut, Download & Delete option .

enter image description here

0

I managed to do this for document library. It will hide the first pop-up and will directly show the menu item like this

<style>
.js-callout-mainElement {
display:none !important;
}
.ms-core-menu-item[text="Compliance Details"] {
display:none;
}
.ms-core-menu-item[text='Delete']
{
display:none !important;
}
</style>

<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.1.min.js">
</script>
<script language="javascript" type="text/javascript">
$(document).ready(hideECBMenuItem);
    function hideECBMenuItem(){
        //alert("jquery is working");
        $("div.ms-list-itemLink").click(function(){
            CoreInvoke('ShowECBMenuForTr', this, event);
        });
    }

</script>

Result: enter image description here

Note: I have hidden many other menu item.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.