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

2010 Q2 build context menu problem

1 Answer 47 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Lee
Top achievements
Rank 1
Lee asked on 21 Jul 2010, 07:34 PM
I use a RadContextMenu that I load programmatically with javascript when the user right-clicks.  This has worked perfectly for some time.  However, since I loaded the new (2010 Q2) build, now when I open the menu more than once the items loaded into the menu are always added onto the items that were already there even though I am calling the get_items().clear() function.

The snippet below is from a simple project that demonstrates the problem:

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <script type="text/javascript" language="javascript">
        function showMenu(contextMenu, e) {            
                contextMenu.trackChanges();
                
                contextMenu.get_items().clear();                
            
                var item = new Telerik.Web.UI.RadMenuItem();
                item.set_text('Sampl Item 1');
                contextMenu.get_items().add(item);               

                var item = new Telerik.Web.UI.RadMenuItem();
                item.set_text('Sampl Item 2');
                contextMenu.get_items().add(item);

                var item = new Telerik.Web.UI.RadMenuItem();
                item.set_text('Sampl Item 3');
                contextMenu.get_items().add(item);

                contextMenu.commitChanges();
         }
    </script>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>

    <div id="div1"  style="width: 400px; height: 100px; border: solid 1px Black">
        Click here to see context menu
    </div>
    <telerik:RadContextMenu ID="RadContextMenu1" Runat="server" OnClientShowing="showMenu">
        <Targets>
            <telerik:ContextMenuElementTarget ElementID="div1" />
        </Targets>
    </telerik:RadContextMenu>
    </form>
</body>
</html>

This simple page worked perfectly prior to updating my control library to 2010 Q2.

1 Answer, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 23 Jul 2010, 02:52 PM
Hi Lee,

Thanks for reporting this.

It is a known issue. At this moment you can remove items one by one as we have problem with the clear() method.  You can track the status of this issue here.

Please accept our apologies for the caused inconvenience.

Greetings,
Veronica Milcheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Menu
Asked by
Lee
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Share this question
or