Dynamically add new target for an existing contextmenu

3 posts, 0 answers
  1. Ron
    Ron avatar
    65 posts
    Member since:
    Oct 2010

    Posted 19 Dec 2016 Link to this post

    I have a contextmenu that is targetting elements with a certain class, for example: $('#menu').kendoContextMenu(target: '.my-class'). Now I adding new DOM elements dynamically after creation of the contextmenu that have the class 'my-class'. How can I reuse the existing contextmenu?
  2. Dimiter Topalov
    Dimiter Topalov avatar
    628 posts

    Posted 21 Dec 2016 Link to this post

    Hi Ron,

    The target option specifies the existing DOM elements the ContextMenu should open on. When new elements are created dynamically, you can reset the ContextMenu target via the setOptions() method, e.g.:


    I hope this helps.

    Dimiter Topalov
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Ron
    Ron avatar
    65 posts
    Member since:
    Oct 2010

    Posted 21 Dec 2016 in reply to Dimiter Topalov Link to this post

    Hi Dimiter,

    Works like a charm. Too bad things like these are a bit hard to find in the documentation. Thank god for the forums.


Back to Top