jQuery UI Widgets Forums Navigation Menu, Context Menu Tree context menu

This topic contains 1 reply, has 2 voices, and was last updated by  Dimitar 8 years, 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Tree context menu #86509

    mpotts
    Participant

    I am adding a context menu to a tree and trying to resolve some issues.

    In various examples I see a “$(‘#jqxTree li’).on(‘mousedown’…” event followed by an ‘isRightClick(event)’ function being used to invoke a context menu. I wonder why you do not just use “$(‘#jqxTree li’).on(‘contextmenu’…” which seems to work for me (I have disabled the default browser context menu).

    I also see the context menu handler being re-attached to the tree whenever a tree item is added or removed. I have also found this necessary but I am not clear why. This also causes me a problem if I refresh the tree as I then find the context menu handler being called multiple on a single click.

    Any clarification or advice would be helpful.

    Thanks,
    Mark

    Tree context menu #86607

    Dimitar
    Participant

    Hello Mark,

    If the $('#jqxTree li').on('contextmenu'... solution works fine on your side, you are free to use it.

    The context menu handler is reattached, because when an item is added or removed, the widget is refreshed and all elements inside are recreated, thus in need of event handlers. Perhaps this information will help you figure out your refresh-related issue.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.