Issues with the Gnt.plugin.TaskContextMenu documentation

Community plugins and extensions
Post Reply
User avatar
mseankelly
Posts: 4
Joined: Mon Sep 05, 2016 8:22 pm

Issues with the Gnt.plugin.TaskContextMenu documentation

Post by mseankelly »

The sample code for customizing the menu had this:

Code: Select all

    
createMenuItems : function () {
        return this.callParent().concat({
            text        : 'My handler',

            handler     : this.onMyHandler,
            scope       : this
        });

        this.on('beforeshow', this.onMyBeforeShow, this);
    },
I believe it should be this:

Code: Select all

    createMenuItems : function () {
        this.on('beforeshow', this.onMyBeforeShow, this);

        return this.callParent().concat({
            text        : 'My handler',

            handler     : this.onMyHandler,
            scope       : this
        });
    },
Also, I'm getting the following error:

Code: Select all

jira-gantt.js:29 Uncaught TypeError: Cannot read property 'setVisible' of null
Here's my code:

Code: Select all

Ext.define('JiraGantt.plugin.TaskContextMenu', {
    extend     : 'Gnt.plugin.TaskContextMenu',

    createMenuItems : function () {
        console.log("createMenuItems");
        this.on('beforeshow', this.onMyBeforeShow, this);

        return this.callParent().concat({
            text        : 'My handler',

            handler     : this.onMyHandler,
            scope       : this
        });
    },

    onMyHandler : function () {
        // the task on which the right click have occured
        var task        = this.rec;
        console.log("onMyHandler");
        // do something with the task on right click...
    },

    onMyBeforeShow : function() {
        // For the moment, don't allow deletes.
        // Might do something fancier later, like allow deletes
        // for versions and MMFs not containing stories.
        console.log("onMyBeforeShow");
        this.down('deleteTask').setVisible(false); // ERROR OCCURS HERE!!
    }
});

Why can't it find 'deleteTask'?

Thanks.

User avatar
Maxim Gorkovsky
Core Developer
Core Developer
Posts: 3075
Joined: Wed Jan 08, 2014 11:46 am

Re: Issues with the Gnt.plugin.TaskContextMenu documentation

Post by Maxim Gorkovsky »

Hello.
Documentation bug will be soon fixed. And you cannot find button because you use wrong selector, use this instead:

Code: Select all

this.down('#deleteTask')

User avatar
mseankelly
Posts: 4
Joined: Mon Sep 05, 2016 8:22 pm

Re: Issues with the Gnt.plugin.TaskContextMenu documentation

Post by mseankelly »

OK, that fixed it. You should probably add the "#" to the sample code as well.

Thanks.

User avatar
mseankelly
Posts: 4
Joined: Mon Sep 05, 2016 8:22 pm

Re: Issues with the Gnt.plugin.TaskContextMenu documentation

Post by mseankelly »

Alright, now I want to remove "Delete Dependency" from the context menu. I've tried "#deleteDependency" and "#dependencyDelete".

Where in the documentation would I find the list of menu selectors?

Thanks.

User avatar
Maxim Gorkovsky
Core Developer
Core Developer
Posts: 3075
Joined: Wed Jan 08, 2014 11:46 am

Re: Issues with the Gnt.plugin.TaskContextMenu documentation

Post by Maxim Gorkovsky »

We do not document such things, it's implementation details. You may find itemId in code, in this case it's #deleteDependencyMenu. But if you're removing already 2 items, you may consider to take full control over them by overriding this method.

User avatar
mseankelly
Posts: 4
Joined: Mon Sep 05, 2016 8:22 pm

Re: Issues with the Gnt.plugin.TaskContextMenu documentation

Post by mseankelly »

OK, help me out. How would I discover that the string should be "#deleteDependencyMenu" without asking in this forum?

Thanks.

User avatar
Maxim Gorkovsky
Core Developer
Core Developer
Posts: 3075
Joined: Wed Jan 08, 2014 11:46 am

Re: Issues with the Gnt.plugin.TaskContextMenu documentation

Post by Maxim Gorkovsky »

Easiest way - inspect items in the debugger. You could also read our code and find it.

Post Reply