I have a radmenu with items that target a iframe inside the page. I like the menu to close immediately after it has been clicked. How can i do that? I think this should be a feature of the menu itself. But it seems it's not possible to do this easily without a lot of javascripts. Can you please show me how to do this?
Thanks in advance.
9 Answers, 1 is accepted
function onClicked(sender, eventArgs) { |
var menu = $find("<%= RadMenu1.ClientID %>"); |
menu.close(); |
} |
function RadMenuCloseOnClicked(sender, args) |
{ |
sender.close(); |
} |
I have registered the OnClientItemClicked of the menu to the javascript function. It seems to achieve what i want. But I still think the menu should include a property to achieve this without the need to write any javascript. This is how a menu standard behaves. It will close when you click on it.
I know this is an old thread, but menu.close() used to work in previous version of Telerik. For some reason it stoped working and collapsing the menu.
<telerik:RadMenu ID="rad_menu" runat="server" EnableRoundedCorners="true" DataFieldID="id" DataFieldParentID="parentID"
EnableEmbeddedSkins="false" Skin="CetTelerikSkin" ExpandAnimation-Duration="0" ExpandAnimation-Type="None" CollapseAnimation-Type="None" CausesValidation="False" ClickToOpen="false" ExpandDelay="500" CollapseDelay="1500"
OnClientItemClicked="OnMenuClientItemClicked"
EnableRootItemScroll="true" Width="100%">
<DefaultGroupSettings ExpandDirection="Auto" OffsetY="2" />
</telerik:RadMenu>
<script type="text/javascript">
function OnMenuclientItemClicked(sender, args){
sender.close();
}
</script>
Any thoughts on why it stopped to work, and if there is a workaround for this?
Thank you for sharing the issue.
Yes indeed -due to a major change that we had to push in the control we recommend using setTimeout when invoking the close function from the click event of the control:
setTimeout(
function
() {
sender.close();
}, 0);
Regards,
Plamen
Telerik by Progress
So the setTimeout seems to work except when render mode is using Mobile from a phone. I have set rendermode="Mobile" and it seems to work from my desktop but when I use my iphone, it will collapse the menu, but it doesn't seem to execute the NavigateUrl into my target.
Any ideas?
Did you try increasing the timeout value passed to the close() method?
setTimeout(
function
() {
sender.close();
}, 100);
You can also test if removing the timeout at all will help (in this way the browser will add this task to the end of the current queue):
setTimeout(function() {
sender.close();
});
Regards,
Vessy
Progress Telerik
Yes, that looks to have fixed the issue.
Thanks!
[quote]Vessy said:Hi Mark,
Did you try increasing the timeout value passed to the close() method?
setTimeout(
function
() {
sender.close();
}, 100);
You can also test if removing the timeout at all will help (in this way the browser will add this task to the end of the current queue):
setTimeout(function() {
sender.close();
}, 0);
Regards,
Vessy
Progress Telerik
You are welcome, Mark - I am glad the suggested solution is working for you.
Regards,
Vessy
Progress Telerik