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

Remove child item through JavaScript.

3 Answers 30 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Berkman
Top achievements
Rank 1
Berkman asked on 08 Mar 2013, 05:30 AM
Hi,

I want to remove a child menu item from my RadMenu using javascript but the script is not working well. Here is the code I tried.
function RemovePremium()
{  
    var menu1 = $find("<%= RadMenuUser.ClientID %>");  
    var menuItem1 = menu.findItemByText("Get Promo");
    if (menuItem1)  
    {             
        menu1.trackChanges();    
        menu1.remove(menuItem1);
        menu1.commitChanges();
} }

Please give your suggestions and help.
Berk.

 

3 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 08 Mar 2013, 08:05 AM
Hi,

Try modifying the code as shown below.
JS:
function RemovePremium() {
        var menu = $find("<%= RadMenuUser.ClientID %>");
        var menuItem = menu.findItemByText("Get Promo");
        if (menuItem) {
           var parentItem = menuItem.get_parent();
            menu.trackChanges();
            parentItem.get_items().remove(menuItem);
           menu.commitChanges();
}
}

Thanks,
Princy
0
A. Koster
Top achievements
Rank 1
answered on 25 Jul 2014, 12:21 PM
Hello,
      Can anyone help me out of my issue. I'm using tab key for index change in the Radmenu for that using below javascript and its working fine but for the last Radmenuitem the child items is not getting hide. so how can i want to change this code to getting hide???

<script language="javascript" type="text/javascript">
function OnClientItemFocus(sender, eventArgs) 
{
eventArgs.get_item().open();
}
</script>

Thanks in Advance
Regards
Reshmaa Ramamurthy.
0
Aneliya Petkova
Telerik team
answered on 30 Jul 2014, 08:17 AM
Hello Reshmaa,

I noticed that you asked the same question in another forum thread. To avoid misunderstanding and duplications, let's continue our communication there:
http://www.telerik.com/forums/how-to-get-selection-index-of-radmenu-using-javascript
Please review our answer and let us know how it goes.

Regards,
Aneliya Petkova
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Menu
Asked by
Berkman
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
A. Koster
Top achievements
Rank 1
Aneliya Petkova
Telerik team
Share this question
or