how to prevent click or selection on node in tree list extjs 7.1 modern

68 Views Asked by At

I want to prevent click or select event on some treelist node so user can not click or select that particular node. I have tried disabled property but it's not working in modern and I'm using version 7.1 of ExtJs.

All is my root node and I want to prevent click or select on the red text node.

1

There are 1 best solutions below

2
Peter Koltai On

Add an itemclick listener (see here) to the Ext.list.Tree, and return false to prevent expand and select for a particular item:

xtype: 'treelist',
listeners: {
  itemclick(sender, info, eOpts) {
    // you will have the item in info.item,
    // so create the condition as you wish
    if (info.item...) {
      return false;
    }
  }
}