This is a migrated thread and some comments may be shown as answers.

Menu Disappear problem

1 Answer 72 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Punit
Top achievements
Rank 1
Punit asked on 28 Nov 2008, 03:10 AM

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?

1 Answer, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 28 Nov 2008, 08:36 AM
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.
Tags
Menu
Asked by
Punit
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Share this question
or