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

How to get rmFocused on Menu Item?

5 Answers 116 Views
Menu
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 17 Jun 2008, 05:15 PM
This was working for me, but can't figure out why not now...

I have a radMenu in a MasterPage.. disabled embedded skins.. styling with css.  The menu automatically added the 'rmFocused' class.. when applicable.

Now, I can't see what's different.. or why.. but it's no longer adding the class to the active tab.  SiteMap is the same, urls the same.. same stylesheets/declarations.. same properties.

Any ideas as to why? 
What factors affect whether menu adds it?  Not adds it?
I thought it was just a matching href to raw url??

Thanks!  D

5 Answers, 1 is accepted

Sort by
0
Erjan Gavalji
Telerik team
answered on 19 Jun 2008, 11:37 AM
Hi David,

The rmFocused class gets applied to an item during keyboard navigation. Can you please, give us some more details on when did that class got applied before? Also, when did you notice the change in the behavior?

Regards,
Erjan Gavalji
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
David
Top achievements
Rank 1
answered on 19 Jun 2008, 04:30 PM

I'm not sure what you mean by "during keyboard navigation"...

I don't know when/how that class got applied before.

I believe I noticed the change when I moved the menu from a .skin file and directly into the masterpage.  The telerik:menu declaration is the same.

The rendered html is exactly the same, except, for the missing rmFocused class on the active item.


0
David
Top achievements
Rank 1
answered on 20 Jun 2008, 09:12 PM

This was my bad--

The Sitemap.CurrentNode was null... must be not null to get the rmFocused class.  Hope that my help someone else.

D
0
Saumitra
Top achievements
Rank 1
answered on 21 Oct 2011, 06:17 AM
Hi,

I'm trying to set the style "rmFocused" on a menu item through client-side javascript. I'm using the OnClientItemOpened event for the same. But somehow I'm not able to achieve it. The code is as below:
function Opened(menu, args) {
    var item = args.get_item();
    var childitems = item.get_items();
    alert(childitems._array.length);
    for (var j = 0; j < childitems._array.length; j++) {
        var childItem = childitems._array[j];
        var href = document.location.href;
        title = childItem.get_navigateUrl();
        lastIndex = title.lastIndexOf('/') + 1;
        name = title.substring(lastIndex, title.length - 5);
        if (href.indexOf(name, 0) > -1) {
            childItem.set_focused();
        }
    }
}

Please let me know if I need to do anything more or if I'm doing anything wrong over here.

A quick reply would be appreciated since its a little urgent.

Thanks,
Saumitra
0
Kate
Telerik team
answered on 25 Oct 2011, 01:30 PM
Hi Saumitra,

In order to apply the rmFocused css class on the client side you can use the set_cssClass property in the following way - args.get_item().set_cssClass("rmFocused");  

Best wishes,
Kate
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Menu
Asked by
David
Top achievements
Rank 1
Answers by
Erjan Gavalji
Telerik team
David
Top achievements
Rank 1
Saumitra
Top achievements
Rank 1
Kate
Telerik team
Share this question
or