function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Craig JonesCraig Jones 

Hiding buttons on enhancedlist

Hi i was implementing a enhancedList for my custom object called 'Standard__c'. I wanted to hide the 'New Standard' button that automatically appears at the top.

 

I have tried a similar thing with listViews (which also has the button) and it worked.

 

In both cases the button is made up from an input element with the name attribute set to 'assign'. The following jQuery worked for listViews, but not enhancedList:

 

j$("input[name=assign]").hide();

 

The only difference i can think of, is that the listView buttons are in a span:

 

<span><input value="New Standard" class="btn" name="new" onclick="navigateToUrl('https://na14.salesforce.com/a09/e?retURL=https%3A%2F%2Fc.na14.visual.force.com%2Fapex%2FlistStandards%3Fcore.apexpages.devmode.url%3D1','LIST_VIEW','new');" title="New Standard" type="button"></span> <span><input value="Change Owner" class="btn" name="assign" onclick="this.form.action = 'https://na14.salesforce.com/_ui/core/customentity/CustomEntityDataTemplateMassAction?retURL=https%3A%2F%2Fc.na14.visual.force.com%2Fapex%2FlistStandards%3Fcore.apexpages.devmode.url%3D1&amp;from=&amp;ent=01Id0000000o09n'" title="Change Owner" type="submit"></span> 

 

Whereas on the enhancedList, the button is within a list. Do i need to be handling the list elements also?

 

<div class="listButtons" id="j_id0:j_id5_listButtons">
<ul class="piped">
<li><input value="New Standard" class="btn" name="new" onclick="navigateToUrl('https://na14.salesforce.com/a09/e?retURL=https%3A%2F%2Fc.na14.visual.force.com%2Fapex%2FlistStandards%3Fcore.apexpages.devmode.url%3D1','LIST_VIEW','new');" title="New Standard" type="button"></li>
<li><input value="Change Owner" class="btn" name="assign" onclick="this.form.action = 'https://na14.salesforce.com/_ui/core/customentity/CustomEntityDataTemplateMassAction?retURL=https%3A%2F%2Fc.na14.visual.force.com%2Fapex%2FlistStandards%3Fcore.apexpages.devmode.url%3D1&amp;from=&amp;ent=01Id0000000o09n'" title="Change Owner" type="submit"></li>
<li class="lastItem"><input id="j_id0:j_id5_refresh" src="s.gif" href="javascript&colon;void(0)" onclick="javascript&colon;ListViewport.instances['j_id0:j_id5'].refreshList()" class="btn refreshListButton" title="Refresh" type="button"></li>
</ul></div>

 

Craig JonesCraig Jones

I figured it out (to a point). 

 

I can hide the button from all enhancedLists by going to Setup -> Create -> 'MyObject'. In the 'Search Layouts' section you can edit the 'Standards List View' entry. In there you can uncheck it from the 'Standard Buttons' list.

 

... I would still like to figure out how to just disable it for the one instance of a list, rather than all.

Shai FisherShai Fisher
You can do it by CSS:
.listButtons .btn[name="buttonapinamelowercase"] {
    display: none !important;
}