How to get rmFocused on Menu Item?

6 posts, 0 answers
  1. David
    David avatar
    57 posts
    Member since:
    Nov 2004

    Posted 17 Jun 2008 Link to this post

    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
  2. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 19 Jun 2008 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. David
    David avatar
    57 posts
    Member since:
    Nov 2004

    Posted 19 Jun 2008 Link to this post


    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.


  5. David
    David avatar
    57 posts
    Member since:
    Nov 2004

    Posted 20 Jun 2008 Link to this post


    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
  6. Saumitra
    Saumitra avatar
    2 posts
    Member since:
    Mar 2009

    Posted 21 Oct 2011 Link to this post

    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
  7. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 25 Oct 2011 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017