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

Menu width width scrolling feature

1 Answer 50 Views
Menu
This is a migrated thread and some comments may be shown as answers.
pirobox
Top achievements
Rank 1
pirobox asked on 31 Aug 2010, 11:06 AM
Hi,
I've the following problem I can't solve alone (I'm using 2010Q2).
I've a menu with EnableRootItemScroll="true", that is, I'd like to have the menu on only one line and if there is not enough space I'd like to see the scrolling arrows.
Everything was working perfectly until I started to work client side with item texts and visibility.
I explain: in the menu I've a button that must work as a warning label, that is, if something is wrong I change client side its text (and image) to show a warning message to the user.
The problem is that when I do so the menu starts to be shown on multiple line.
I've debugged a bit the JS and I've found out that you calculate the width of all the root items when the page is rendered and assign the total to the <UL> container. Changing the text, the width should change.

I've already tried this:
function recalculateWidth()
{
var menu1 = $find("<%= Menu1.ClientID %>");
var menuItems = menu1.get_items();
var newWidth = 0;
for (var i = 0; i < menuItems.get_count(); i++)
newWidth += menuItems.getItem(i).get_element().offsetWidth;
menu1.get_childListElement().style.width = newWidth;
}
and apparently it works, that is, the menu no longer is displayed on more than one line, but the scrolling arrows behave weirdly: the rightmost buttons are being cut off. It is like you are setting the width also into the scrolling arrows mechanism, but I can't find it.
May you help me with this?

Best regards, Andrea Pirola

1 Answer, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 31 Aug 2010, 12:06 PM
Hello Andrea,

Could you please try to call repaint() method of the client-side object of the menu after these changes?  It should recalculate the width, so you don't need to do it manually.

Regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Menu
Asked by
pirobox
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or