Radhika
Radhika

Reputation: 43

How to set up a contextmenu for treelist in Ext js 7 i.e a menu on right click of the treelist item?

Hi I am trying to have a menu open up when i right click on any treelist item. Based on the element I right click on, i need to show a dynamic menu with options. How can i achieve this. I am new to modern toolkit of Ext 7 and am migrating my code from EXT 5 to EXT 7. Please help.

Upvotes: 1

Views: 269

Answers (1)

Radhika
Radhika

Reputation: 43

contextmenu event on the element works. I was able to figure it out myself.

The below code helps

{
       xtype: 'treelist',
       reference: 'projectMenu',
       highlightPath: true,
       bind: {
         store: '{navItems}'
       },
       listeners: {
         'contextmenu': {
          element: 'element', //bind to the underlying element property on the panel
          fn: 'onContextMenu'
          }
       }
  }

Upvotes: 1

Related Questions