Tuesday, 24 July 2012

Hide Action Menu in Business Data List Webpart

To hide the action menu there is an OOTB option in the Business Data List Webpart , but it hides the Paging controls as well , so how to hide the action menus and keep the paging controls
The first thing pumps to your head is to do so you should alter the xslt used by the webpart , and simply remove the first td in the below place holder



  <asp:PlaceHolder id="ActionBarTable" runat="server">
        <table class="ms-menutoolbar" cellpadding="2" cellspacing="0" border="0" width="100%">
          <tr>
           <b> <td class="ms-toolbar" style="padding-left:3px;text-align:left" nowrap="true">
              <xsl:value-of select="$ActionsText" />
            </td></b>
            <td class="ms-toolbar" style="padding-right:3px;text-align:right" nowrap="true">
              <xsl:value-of select="$EditViewText" />
            </td>
          </tr>
        </table>
      </asp:PlaceHolder>



but the action menu keep appearing , so I think of a client side script to hide the action menu

by using the Content Editor WebPart and injecting the below script



<script type='text/javascript' src='valid url of latest jquery'></script>
<script type='text/javascript'>
$(document).ready(function() {
  $("table [class='ms-menutoolbar'] tbody tr td:first-child").hide();
});
</script>



the last thing to do is to ensure that animation is set to off in the webpart Options as if the animation is enabled the JavaScript function will called before even the action menu rendered

Related Articles