I have read this discussion,
and also read documentation,
https://forum.bryntum.com/viewtopic. ... enu#p11122
I have made changes accordingly but what I get is shown in image bellow,
I want to hide some items from my custom context menu,
Instead it shows an empty item on menu.
How to resolve it?
Support Forum
Can you post your modified context menu code ?
JavaScript/Angular/ExtJS consulting - kuba@virtualdesign.pl
Did you read the docs? https://bryntum.com/products/gantt-for-extjs/docs/#!/a ... ontextMenu
It explains that you can override getMenuItems, look at the TaskContextMenu plugin source and you'll see it creates its items.
It explains that you can override getMenuItems, look at the TaskContextMenu plugin source and you'll see it creates its items.
Well, sure - if you just read the source code it'll be obvious. You'll need to override this method:
And leave in there what you want. I'd very much recommend writing your own menu, good opportunity to learn how to build custom extensions too!
createMenuItems : function() {
var texts = this.texts;
return [
{
handler : this.deleteTask,
requiresTask: true,
scope : this,
text : texts.deleteTask
},
{
handler : this.editLeftLabel,
requiresTask: true,
scope : this,
text : texts.editLeftLabel
},
{
handler : this.editRightLabel,
requiresTask: true,
scope : this,
text : texts.editRightLabel
},
{
text : texts.add,
menu : {
plain : true,
items : [
{
handler : this.addTaskAboveAction,
requiresTask: true,
scope : this,
text : texts.addTaskAbove
},
{
handler : this.addTaskBelowAction,
scope : this,
text : texts.addTaskBelow
},
{
handler : this.addMilestone,
requiresTask: true,
scope : this,
text : texts.addMilestone
},
{
handler : this.addSubtask,
requiresTask: true,
scope : this,
text : texts.addSubtask
},
{
handler : this.addSuccessor,
requiresTask: true,
scope : this,
text : texts.addSuccessor
},
{
handler : this.addPredecessor,
requiresTask: true,
scope : this,
text : texts.addPredecessor
}
]
}
},
{
text : texts.deleteDependency,
requiresTask : true,
isDependenciesMenu : true,
menu : {
plain : true,
listeners : {
beforeshow : this.populateDependencyMenu,
// highlight dependencies on mouseover of the menu item
mouseover : this.onDependencyMouseOver,
// unhighlight dependencies on mouseout of the menu item
mouseleave : this.onDependencyMouseOut,
scope : this
}
}
}
];
},