Hey,
So - I'm having a very strange issue with a RadContextMenu that we're using. Here's the scenario:
I'm editing this object on the page, when changes occur they are marked in a hidden field. When I right click on the object, it parses the information in the hidden field and creates the RadMenuItems to display in the context menu.
HOWEVER: I can't seem to get the items to clear. I need to clear the items every time I show the context menu, which is what I believe I'm doing. I will get "item1", "item2", "item1", "item2" if I open it twice.
Here's the important code:
I've attempted to re-create the scenario in a new rad website, but it works just as expected.
Anyone have any ideas? Thanks!
So - I'm having a very strange issue with a RadContextMenu that we're using. Here's the scenario:
I'm editing this object on the page, when changes occur they are marked in a hidden field. When I right click on the object, it parses the information in the hidden field and creates the RadMenuItems to display in the context menu.
HOWEVER: I can't seem to get the items to clear. I need to clear the items every time I show the context menu, which is what I believe I'm doing. I will get "item1", "item2", "item1", "item2" if I open it twice.
Here's the important code:
var
contextMenu = $find(itemContextMenu);
$telerik.cancelRawEvent(e);
if
((!e.relatedTarget) || (!$telerik.isDescendantOrSelf(contextMenu.get_element(), e.relatedTarget))) {
contextMenu.trackChanges();
contextMenu.get_items().clear();
var
item1 =
new
Telerik.Web.UI.RadMenuItem();
item1.set_text(
"item1"
);
contextMenu.get_items().add(item1);
var
item2 =
new
Telerik.Web.UI.RadMenuItem();
item2.set_text(
"item2"
);
contextMenu.get_items().add(item2);
contextMenu.commitChanges();
contextMenu.show(e);
}
I've attempted to re-create the scenario in a new rad website, but it works just as expected.
Anyone have any ideas? Thanks!