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

set ExpandDirection client-side

1 Answer 27 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Albert Shenker
Top achievements
Rank 1
Veteran
Albert Shenker asked on 21 May 2013, 08:03 PM
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"
                                                    runat="server"
                                                    EnableRoundedCorners="true"
                                                    EnableShadows="true"
                                                    style="position:absolute;"
                                                    OnClientItemClicked="TaskMenuClickedHandler_D">
                                        <DefaultGroupSettings ExpandDirection="Up" />
                                    </telerik:RadMenu>


function CreateItem_D(text, value) {
 
                var menuItem = new Telerik.Web.UI.RadMenuItem();
                menuItem.set_text(text);
                menuItem.set_value(value);
 
                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
 
                 menu.get_items().add(categoryMenuItem);
                    
                return categoryMenuItem;
 
 
               
            }

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 22 May 2013, 04:55 AM
Hi Albert,

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

JavaScript:
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.

Thanks,
Shinu.
Tags
Menu
Asked by
Albert Shenker
Top achievements
Rank 1
Veteran
Answers by
Shinu
Top achievements
Rank 1
Share this question
or