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

not all submenu's are shown

2 Answers 157 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Maurice
Top achievements
Rank 1
Veteran
Maurice asked on 15 Nov 2017, 09:53 AM

HI,

submenu's aren't working like I expect them to work.

In my menu the submenu below personal (line 20) & account (line 104) works like I would like it to work.

The menu's below hr-test (line 72) and hr (line 92) are strange and aren't showing all items

See also the attachment of hr-test. only 2 out of the 5 real menu items are shown

I can't find the reason why I only get some submenu's.

Could somebody help?

001.@(Html.Kendo().Menu()
002.            .Name(componentName: "Menu")
003.            .Animation(enable: true)
004.            .HtmlAttributes(new {@class = "m-k-menu-header"})
005.            .Items(items =>
006.            {
007.                items.Add()
008.                    .HtmlAttributes(new {@class = "m-k-menu-header"})
009.                    .Text(value: "Portal")
010.                    .Action(actionName: "Index", controllerName: "Home")
011.                    .Items(innerChildren =>
012.                    {
013.                        innerChildren.Add()
014.                            .Text(value: "Improvementlist")
015.                            .Action(actionName: "index", controllerName: "improvement")
016.                            .HtmlAttributes(new {@class = "m-k-menu-header"});
017.                    });
018.                items.Add()
019.                    .HtmlAttributes(new {@class = "m-k-menu-header"})
020.                    .Text(value: "Personal").Action(actionName: "OverviewPresence", controllerName: "Presence")
021.                    .Items(innerChildren =>
022.                    {
023.                        innerChildren.Add()
024.                            .Text(value: "Manage presence")
025.                            .Action(actionName: "ManagePresence", controllerName: "Presence")
026.                            .HtmlAttributes(new {@class = "m-k-menu-header"});
027.                        innerChildren.Add()
028.                            .Text(value: "Overview presence")
029.                            .Action(actionName: "OverviewPresence", controllerName: "Presence")
030.                            .HtmlAttributes(new {@class = "m-k-menu-header"});
031.                        innerChildren.Add()
032.                            .Text(value: "Set week complete")
033.                            .Action(actionName: "Index", controllerName: "WeekComplete")
034.                            .HtmlAttributes(new {@class = "m-k-menu-header"});
035.                    });
036.                items.Add()
037.                    .Text(value: "Plan")
038.                    .Action(actionName: "Index", controllerName: "Planned")
039.                    .HtmlAttributes(new {@class = "m-k-menu-header"});
040.                items.Add()
041.                    .Text(value: "Write")
042.                    .Action(actionName: "Index", controllerName: "Written")
043.                    .HtmlAttributes(new {@class = "m-k-menu-header"});
044.                items.Add()
045.                    .Text(value: "Client")
046.                    .Action(actionName: "Index", controllerName: "Client")
047.                    .HtmlAttributes(new {@class = "m-k-menu-header"});
048.                items.Add()
049.                    .HtmlAttributes(new {@class = "m-k-menu-header"})
050.                    .Text(value: "Project")
051.                    .Action(actionName: "NotFinished", controllerName: "Project")
052.                    .HtmlAttributes(new {@class = "m-k-menu-header"})
053.                    .Items(innerChildren =>
054.                    {
055.                        innerChildren.Add()
056.                            .Text(value: "All Projects")
057.                            .Action(actionName: "Index", controllerName: "Project")
058.                            .HtmlAttributes(new {@class = "m-k-menu-header"});
059.                        innerChildren.Add()
060.                            .Text(value: "All active Projects")
061.                            .Action(actionName: "NotFinished", controllerName: "Project")
062.                            .HtmlAttributes(new {@class = "m-k-menu-header"});
063.                    });
064.                items.Add()
065.                    .Text(value: "Employee")
066.                    .Action(actionName: "Index", controllerName: "Employee")
067.                    .HtmlAttributes(new {@class = "m-k-menu-header"});
068.                items.Add()
069.                    .Text(value: "PS")
070.                    .Action(actionName: "WrittenComplete", controllerName: "PS")
071.                    .HtmlAttributes(new {@class = "m-k-menu-header"});
072.                items.Add()
073.                    .Text("HR")
074.                    .Items(children =>
075.                    {
076.                        children.Add().Text("Billability").Action("Billability", "HR").HtmlAttributes(new {@class = "m-k-menu-header"});
077.                        children.Add().Text("Jeans");
078.                        children.Add().Text("Compensation").Action("Compensation", "HR").HtmlAttributes(new {@class = "m-k-menu-header"});
079.                        children.Add().Text("Jeans");
080.                        children.Add().Text("Leave").Action("Leave", "HR").HtmlAttributes(new {@class = "m-k-menu-header"});
081.                        children.Add().Text("Jeans");
082.                        children.Add().Text("OverviewPresence").Action("OverviewPresence", "HR").HtmlAttributes(new {@class = "m-k-menu-header"});
083.                        children.Add().Text("Jeans");
084.                        children.Add().Text("YearTarget").Action("YearTarget", "HR").HtmlAttributes(new {@class = "m-k-menu-header"});
085.                        children.Add().Text("Jeans");
086.                        children.Add().Text("Knitwear");
087.                        children.Add().Text("Shirts");
088.                        children.Add().Text("Belts");
089.                        children.Add().Text("Socks");
090.                        children.Add().Text("Fan Zone");
091.                    });
092.                items.Add()
093.                    .Text(value: "HR")
094.                    .HtmlAttributes(new {@class = "m-k-menu-header"})
095.                    .Items(innerChildren =>
096.                    {
097.                        innerChildren.Add().Text(value: "Billability").Action(actionName: "Billability", controllerName: "HR", routeValues: null).HtmlAttributes(new {@class = "m-k-menu-header"});
098.                        innerChildren.Add().Text(value: "Compensation").Action(actionName: "Compensation", controllerName: "HR", routeValues: null).HtmlAttributes(new { @class = "m-k-menu-header" });
099.                        innerChildren.Add().Text(value: "Leave").Action(actionName: "Leave", controllerName: "HR", routeValues: null).HtmlAttributes(new { @class = "m-k-menu-header" });
100.                        innerChildren.Add().Text(value: "OverviewPresence").Action(actionName: "OverviewPresence", controllerName: "HR", routeValues: null).HtmlAttributes(new { @class = "m-k-menu-header" });
101.                        innerChildren.Add().Text(value: "YearTarget").Action(actionName: "YearTarget", controllerName: "HR", routeValues: null).HtmlAttributes(new {@class = "m-k-menu-header"});
102.                    });
103. 
104.                items.Add()
105.                    .HtmlAttributes(new {@class = "m-k-menu-header"})
106.                    .Text(value: "Account")
107.                    .Items(innerChildren =>
108.                    {
109.                        innerChildren.Add().Text(value: "Manage").Action(actionName: "Index", controllerName: "Manage", routeValues: null).HtmlAttributes(new {@class = "m-k-menu-header"});
110.                        innerChildren.Add().Text(value: "Log off").Url(value: "javascript:document.getElementById('logoutForm').submit()").HtmlAttributes(new {@class = "m-k-menu-header"});
111.                    });
112.            })
113.            )

 

 

2 Answers, 1 is accepted

Sort by
0
Maurice
Top achievements
Rank 1
Veteran
answered on 15 Nov 2017, 10:28 AM

If I change the controller name in the second line from

children.Add().Text("Billability").Action("Billability", "HR").HtmlAttributes(new {@class = "m-k-menu-header"});
children.Add().Text("Compensation").Action("Compensation", "hr").HtmlAttributes(new {@class = "m-k-menu-header"});

 

to

children.Add().Text("Billability").Action("Billability", "HR").HtmlAttributes(new {@class = "m-k-menu-header"});
children.Add().Text("Compensation").Action("Compensation", "random-other-controller-or-fake controllername").HtmlAttributes(new {@class = "m-k-menu-header"});

 

It works. At least the menu item is shown.

 

0
Ivan Danchev
Telerik team
answered on 17 Nov 2017, 09:57 AM
Hello Maurice,

Attached you can find a sample project in which the Menu from your first is added to the Home/Index view. It works as expeted at my end and shows all declared sub items within the HR item. An HR controller is added and the Compensation Action is hit on clicking the item with text "Compensation". Could you modify the example accordingly so that it reproduces the issue and attach it back for further review?

Regards,
Ivan Danchev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Menu
Asked by
Maurice
Top achievements
Rank 1
Veteran
Answers by
Maurice
Top achievements
Rank 1
Veteran
Ivan Danchev
Telerik team
Share this question
or