[DESIGNER] How to disable a context menu item or ribbon button conditionally?

Posted by: ffrey on 16 December 2020, 1:35 am EST

  • Posted 16 December 2020, 1:35 am EST

    Hello, client I work for has purchased the designer and we are going to add some additional context menu items as well as buttons in the ribbon. I have followed the documentation and they display perfectly, but now I need to disable (in ribbon) and hide (in context menu) the items, is there a way to do so?

    Documentation shows how to add but not how to create conditions to hide or disable them.


    May I ask you to provide some examples?

    thanks in advance, Fernando
  • Marked as Answer

    Replied 16 December 2020, 11:43 pm EST


    You may use visibleContext property to hide the element from the designer context menu. Please refer to the following code snippet and attached sample that demonstrates the same.

    constructor(private spinner: NgxSpinnerService) {
    (config as any).commandMap = this.element;

    element = {
    "designer.insertSignature": {
    text: "Insert Signature",
    commandName: "designer.insertSignature",
    visibleContext: "ClickRowHeader",
    // execute_InsertSignature, following just a simple demo code snippet
    () =>{
    console.log("Insert Signature");
    this.element["designer.insertSignature"].visibleContext = "none"
    this.element["designer.insertSignature"].visibleContext = "ClickRowHeader"



Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels