Friday, March 4, 2011

Is there any way to change the index of menu items in a SharePoint menu?

When the "New" menu item on a Document Library expands the default seems to be to list the document templates for that list and the "New folder" as the final element (if "New folder" has not been disabled). I have added a new custom menu item but it is displayed after "New folder" and I would like it to be shown at index 0 in order to be the default action if the user clicks "New" rather then expanding the menu.

I have tried to delete all document templates and disabling the "create folder" menu item, adding the custom menu item and then enabling the "create folder" menu, but then "Create folder" is insert before my custom menu item...doh.

Is there a way to ensure that my custom menu item remains at index 0 or a way to ensure that my custom menu item is the default menu item?

TIA

From stackoverflow
  • The only way that I know to do this is to use JavaScript to adjust the order of the items by manipulating the DOM.

    If that's something you would consider, then I have a utility that will help: http://www.codeplex.com/ShUIE/

    You can use that to define a custom JavaScript that only runs against the Invalid mode of a Document Library, and then insert a piece of JavaScript (easier to use jQuery as it's available) in which to get hold of the menu and take the New menu item and prepend it to the parent... which would move it to index 0.

  • OK, I did find a workaround: disable the folder option AND make sure that the "Allow management of content types" option is enabled. Then you can remove any existing content types from the list, and now the custom menu item is at index 0, but since the new menu item is not a content type it will not be triggered by clicking "New" but it will do for now :-)

0 comments:

Post a Comment