Share via


Shell.UI.Drawer.js

 

Applies To: Windows Azure Pack

Provides methods to add or remove menu items from the New section of the Drawer.

Each menu item can have sub-items.

Widgets

None.

Types

Shell.UI.Drawer.Menu.ActionMenuItem()

Shell.UI.Drawer.Menu.ContainerMenuItem()

Shell.UI.Drawer.Menu.QuickAddMenuItem()

Properties

None

Methods

Name

Description

Returns

Parameters

Shell.UI.Drawer.Menu.addMenuItem

Adds the menu item to the drawer.

Nothing

item (Object): Either Shell.UI.Drawer.Menu.ContainerMenuItem orShell.UI.Drawer.Menu.QuickAddMenuItem to add to the menu.

Shell.UI.Drawer.addDrawerOpenedCallback

Adds the drawer opened callback function.

callback

Callback: The callback function to be added.

Shell.UI.Drawer.close

Closes the drawer.

Nothing

None.

Shell.UI.Drawer.Menu.exists

Returns whether a node with the given path exists in the menu.

Boolean

path (String): Path to the menu item. Paths are of the format id1/id2.

Shell.UI.Drawer.Menu.getChildren

Gets an array of child ids for a given node.

String Array

path (String): Path to the menu item. Paths are of the format id1/id2.

Shell.UI.Drawer.open

Opens the menu drawer.

Nothing

None.

Shell.UI.Drawer.openHelp

Opens the help drawer. Optionally you can set a URL for the help too.

Nothing

url (String): Help URL.

Shell.UI.Drawer.Menu.removeMenuItem

Removes the menu item from the drawer.

Nothing

item (Object): Either Shell.UI.Drawer.Menu.ContainerMenuItem orShell.UI.Drawer.Menu.QuickAddMenuItem to remove to the menu.

Shell.UI.Drawer.removeDrawerOpenedCallback

Removes a drawer opened callback

callback

Callback: The callback method to be removed.

Shell.UI.Drawer.Menu.selectMenuPath

Selects a menu path.

Nothing

Path: The menu path.

Shell.UI.Drawer.Menu.QuickAddMenuItem.setData

Sets the data passed to the menu items in callbacks.

Nothing

data (Object): Data object.

Shell.UI.Drawer.Menu.QuickAddMenuItem.setExtension

Sets the name of the extension that owns the template to be used for rendering the quick create form.

Nothing

extension (String): Name of the extension.

Shell.UI.Drawer.setHelpUrl

Sets the help url but does not open the drawer.

Nothing

url (String): Help URL.

Shell.UI.Drawer.Menu.QuickAddMenuItem.setLabel

Sets the label to be used for the OK button of the quick create form.

Nothing

label (String): Label for the OK button.

Shell.UI.Drawer.Menu.QuickAddMenuItem.setTemplate

Sets the template used to render the quick create form.

Nothing

template (String): Template used to render the quick create form.

Adding Custom Icon to the Items in the Global Add Menu

Custom images can be added as icons for user defined items in the global add menu. Menu types defined above are used to add menu items, sub-items and assign a custom icon to it.

A menu item is added to the global new container using ContainerMenuItem method. This method reads the following parameters:

  • Extension name

  • Parent container if any. This value is empty if there is no parent.

  • Menu Item ID that uniquely identifies this item.

  • Text for the menu item

  • Image URL for the menu item.

  • Description of the menu item.

Below is the sample implementation to add a menu item that has customized icon.

var item = new Shell.UI.Drawer.Menu.ContainerMenuItem("WebSystemAdminExtension", "", "MenuItemId", "sample container", "/Content/Images/icons-gridview-status.png", "description of the menu item")
Shell.UI.Drawer.Menu.add(item)

Below is the screenshot of the global new container after adding a menu item with custom image

Menu Item Image

A submenu item to the item created above can be added using QuickAddMenuItem method. This method reads the following parameters:

  • Extension name

  • Parent container ID.

  • Menu Item ID that uniquely identifies this item.

  • Text for the menu item

  • Image URL for the menu item.

  • Description of the menu item.

  • Name of the template to be displayed when the item is selected

  • Text for the ok button.

Below is the sample implementation to add a submenu item for the above created menu item.

var item = new Shell.UI.Drawer.Menu.QuickAddMenuItem("WebSystemAdminExtension", "MenuItemId", "sample create item id", "Sample Sub-Item", "/Content/Images/icons-gridview-status.png", " description of the sub-menu item ", "RegisterResourceProvider", "sample text for OK", {})
Shell.UI.Drawer.Menu.add(item)

The above code adds a submenu item as shown in the following screenshot.

SubMenu Item Image

See Also

Windows Azure Pack Extension Shell Library Reference