How to disable context menu in readonly cells of flexgrid

Posted by: zam.abdulvahid on 19 October 2018, 10:15 am EST

    • Post Options:
    • Link

    Posted 19 October 2018, 10:15 am EST

    Hi Team,

    How can I disable context menu in readonly cells of flexgrid.

    Best regards,

    Zam

  • Posted 22 October 2018, 1:09 am EST

    Hi Zam,

    You may handle the ‘contextmenu’ event and stop its propagation on read-only cells to prevent context-menu from showing up.

    grid.hostElement.addEventListener('contextmenu', (e)=>{
          let ht = grid.hitTest(e);
          if(ht.panel && this.isReadOnly(ht.panel, ht.row, ht.col)){
            e.preventDefault();
            e.stopPropagation();
          }
        }, true);
    

    You may also refer to the following sample: https://stackblitz.com/edit/angular-jpgshn?file=app%2Fapp.component.ts

    ~Sharad

  • Posted 23 October 2018, 5:23 am EST

    Perfect. Thank you Sharad.

    ~Zam

Need extra support?

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

Learn More

Forum Channels