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

how to show all items of RadMenu expanded

3 Answers 67 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Ujwala
Top achievements
Rank 1
Ujwala asked on 07 Oct 2014, 06:06 AM
Hi all, i am using Radmenu control in a project. so we have an urgent requirement from client that all the radmenu items are shows expanded. we need to show root element and its child elements and sub child elements are all expanded. so how we can achieve this functionality? Please help me its urgent task to do?

3 Answers, 1 is accepted

Sort by
0
Aneliya Petkova
Telerik team
answered on 07 Oct 2014, 02:02 PM
Hello,

In order to expand all RadMenuItems with children, you can try the following code:
<telerik:RadMenu ID="RadMenu1" runat="server" OnClientLoad="OnClientLoad" ClickToOpen="true" OnClientItemClosing="ItemClosing">
    <Items>
        ...
    </Items>
</telerik:RadMenu>
<script type="text/javascript">
    var $ = $telerik.$;
 
    function OnClientLoad(sender) {
        menu1 = sender;
 
        for (var i = 0; i < sender.get_allItems().length; i++) {
            if (sender.get_allItems()[i].get_items().get_count() > 0) {
                sender.get_allItems()[i].open();
            }
        }
    }
 
    function ItemClosing(menu, args) {
        args.set_cancel(true);
    }
</script>

Hope this will be helpful.

Regards,
Aneliya Petkova
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Ujwala
Top achievements
Rank 1
answered on 08 Oct 2014, 05:16 AM
Thanks Aneliya, i have tried this code but no success. only the last element of radmenu gets expanded and visible and we are showed this only on devices.Please suggest me any other solution/ help
0
Aneliya Petkova
Telerik team
answered on 08 Oct 2014, 07:43 AM
Hello,

Could you please elaborate a little more on your exact scenario since I'm not quite sure I understand it exactly. From your first post, I understood that you need to expand all items of the RadMenu. If this is not the case, please explain in details which item you need to expand and on which event exactly. Also in your last post, you mention that you need this functionality to works on some devices. It would be helpful if you provide information where you need this to work(pc, tablets or smartphones and the browsers).
Also it would be very helpful if you send me your RadMenu markup.

I will be waiting to your reply.

Regards,
Aneliya Petkova
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Menu
Asked by
Ujwala
Top achievements
Rank 1
Answers by
Aneliya Petkova
Telerik team
Ujwala
Top achievements
Rank 1
Share this question
or