Menu Disappear problem

2 posts, 0 answers
  1. Punit
    Punit avatar
    12 posts
    Member since:
    Sep 2008

    Posted 27 Nov 2008 Link to this post

    Hi

    I am using menu as a context menu on grid.

    I am inserting a new menu item at runtime from JavaScript. My problem is that the Menu does not disappear after on click event of the newly created item. The click event puts a drop down list through javascript in one of the columns of selected row.

    var childItem = new Telerik.Web.UI.RadMenuItem();

     

    childItem.set_text(strOption);

    childItem._click = AdjustOwner_LoadDropdown; // AdjustOwner_LoadDropdown is a function

    menu.get_items().insert(2, childItem);

    Am I missing setting some property?

  2. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 28 Nov 2008 Link to this post

    Hi Punit,

    You need to wrap the changes made in a trackChanges / commitChanges block:

    menu.trackChanges(); 
    var childItem = new Telerik.Web.UI.RadMenuItem(); 
    childItem.set_text(strOption); 
    childItem._click = AdjustOwner_LoadDropdown; // AdjustOwner_LoadDropdown is a function 
    menu.get_items().insert(2, childItem);  
    menu.commitChanges(); 

    You can find more details here: Client-Side Programming > RadMenuItemCollection object

    Sincerely yours,
    Veselin Vasilev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top