Custom Ribbon button doesn’t show up

24 Oct

Ribbon customizations are not that easy to troubleshoot. If something is wrong, the customization simply doesn’t show up.

Beside debug the JavaScript (SP.Ribbon.debug.js), checking the sequence of e.g. the button definition (not multiples of 10 or 100, because SharePoint uses these) and if the function name in the definition of the button, the command attribute, and the function name in the CommandUIHandler are the same, there is another important and easily overlooked issue.

Suppose a customization is registered on a list. A nice example to visualize this is the post  A better user experience with the dialog framework and notifications. The button “Mark item(s) as completed” is shown in the Items tab when one or more items are selected in the list.

The next step here is to add a list instance as a webpart on another page. When this webpart is selected on the page it was just added, the button does not appear on the menu.

By default, the toolbar type property of the webpart is set to summary toolbar. The summary toolbar doesn’t load any customizations. So it doesn’t load the custom button. Setting the toolbar type to full toolbar in the webpart properties of the webpart will show the customization.

One Reply to “Custom Ribbon button doesn’t show up”

  1. I’m running into something somewhat similar. I’m not sure precisely what the matter is. I have a custom tab (Id = Ross.SetupAdmin.Tab) defined by, I’ll call it, ‘CustomAction 1’. Now, within ‘CustomAction 2’, I am defining an ‘Archive’ button which has a location that causes it to show up in the tab defined by CustomAction 1. The reason for this is to apply more strict rights to the ‘Archive’ button.

    I have a task list that comes with five or six default views. None of the view pages have further customizations (no additional web parts). So, I don’t think I have to concern myself with the Toolbar type – it seems to be already defaulted to ‘Full Toolbar’ when I bother to go into edit mode.

    Any initial navigation to a particular view page works fine, I see the Archive button inside of the custom tab. I check some items, then I press ‘Archive’ to cause the items to be moved off of the list. When the view refreshes, the custom Archive button (defined by CustomAction 2) has *disappeared*. Other buttons defined natively within the custom tab re-appear without problem.

    Literally, if I append this querystring to the URL:
    ?VisibilityContext=WSSTabPersistence&InitialTabId=Ross.SetupAdmin.Tab
    Then the custom button fails to show (and I get some javascript error in my status bar). If I remove the above query string, and go to the default view URLs, then the button displays just fine.

    The above is the same query string created by SharePoint when calling:
    SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);

Comments are closed.