Disabling the wj-menu-item

Posted by: mayank.dixit on 24 August 2021, 12:22 am EST

  • Posted 24 August 2021, 12:22 am EST

    I am using WizmoTreeView in that I am using Context Menu how can I disable Wj-menu-item.

    In the below image u can see that I want some of the menu items to be disabled.
  • Replied 24 August 2021, 11:18 pm EST

    Hi,

    To disable some of the items from the context-menu, you may use the dropDown property of the Menu and check for the items with certain properties or names, and add the wj-state-disabled class to the items. You can use the isDroppedDownChanging event of Menu to disable the context-menu items. Please refer to the sample below:

    [url]https://stackblitz.com/edit/js-jwsktz[/url

    Regards,
    Ashwin
  • Replied 13 September 2021, 10:19 pm EST

    Thank You for the quick help I have two more queries regarding this
    1:- Can we hide some menu items and show them conditionally.
    2:-Can we use any Ds like Array to populate those menu items.
  • Replied 14 September 2021, 5:26 pm EST

    Hello,

    1. Yes you can do that, you need to add and remove the wj-state-disabled class to the context menu according to the conditions.

    2. Yes, you can use the itemSource property of the menu to provide the array of items that you would like to show on the context menu.

    Please refer to the sample link demonstrating the above points:https://stackblitz.com/edit/js-hi5quo?file=index.js

    Let us know if that's works for you.

    Regards
Need extra support?

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

Learn More

Forum Channels