set ExpandDirection client-side

2 posts, 0 answers
  1. Albert Shenker
    Albert Shenker avatar
    550 posts
    Member since:
    Mar 2004

    Posted 21 May 2013 Link to this post

    I have an empty menu declaration and I add items to the menu client-side in response to various JavaScript events. I would like the menu items to expand up. I tried setting the DefaultGroupSettings ExpandDirection but the menu items still expand down. I have also tried setting the expand direction on the dynamically-added root menu items client-side, but I don't know if my syntax is right and this doesn't appear to work:

    <telerik:RadMenu ID="rmTaskMenu"
                                            <DefaultGroupSettings ExpandDirection="Up" />

    function CreateItem_D(text, value) {
                    var menuItem = new Telerik.Web.UI.RadMenuItem();
                    return menuItem;
    function AddRootMenuItem_D(menu, category) {
                     var  categoryMenuItem = CreateItem_D(category, 'Category_' + category);
                     categoryMenuItem.get_attributes().setAttribute("category", category);
                     categoryMenuItem.get_groupSettings().set_expandDirection('Up'); // is this the correct syntax? If so, it isn't working
                    return categoryMenuItem;

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 21 May 2013 Link to this post

    Hi Albert,

    The set_expandDirection() does not accept string arguments like you have given. The Expand Direction can be set from JavaScript as follows.

    menuItem._groupSettings.set_expandDirection(1);  //accept integer argument

    Setting set_expandDirection(1) will expand the menu upwards and set_expandDirection(2) will expand the menu downwards. Please have a look at this demo on RadMenu Expand Direction.

  3. DevCraft R3 2016 release webinar banner
Back to Top