locked
tfs extension with menu control childs - childs not showing RRS feed

  • Question

  • Hi,

    I'm trying to create extension which allow me to open a work item context menu and see new control and when I hover on the control a sub menu will open. just like the way 'Move to iteration' and 'Templates' works.

    this is the vss-extension.json contributions section:

    "contributions": [
                {
                    "id": "releaseMenuAction",
                    "type": "ms.vss-web.action",
                    "description": "test",
                    "targets": [
                        "ms.vss-work-web.backlog-item-menu",
                        "ms.vss-work-web.work-item-context-menu"
                        ],
                    "properties": {
                        "name": "releaseMenuAction",
                        "text": "Assign to release",
                        "title": "Assign to release",
                        "icon": "img/delivery_small.png",
                        "uri": "index.html"
                    }
                }
            ]

    and this is the html

    <!DOCTYPE html>
    <html>
    
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script src="sdk/VSS.SDK.min.js"></script>
    </head>
    
    <body>
        <script>
            VSS.init({ usePlatformScripts: true, usePlatformStyles: true, explicitNotifyLoaded: true });
    
            // Use an IIFE to create an object that satisfies the IContributedMenuSource contract
            var menuContributionHandler = (function () {
                "use strict";
                return {
                    getMenuItems: function (actionContext) {
                        var subMenus = [
                            {
                                text: "one",
                                action: function (actionContext) {
                                    alert("one");
                                }
                            },
                            {
                                text: "two",
                                action: function (actionContext) {
                                    alert("two");
                                }
                            }
                        ];
    
                        return [
                            {
                                text: "Assign to release",
                                group: "actions",
                                icon: "img/delivery_small.png",
                                childItems: subMenus
                            }
                        ];
                    }
                };
            }());
    
            // Associate the menuContributionHandler object with the "releaseMenuAction" menu contribution from the manifest.
            VSS.register("releaseMenuAction", menuContributionHandler);
        </script>
    </body>
    
    </html>

    The result I'm getting is only to see the 'Assign to release' control in the menu but without his childs.

    What am I missing?

    Thanks.


    Monday, December 4, 2017 11:11 AM