or
$(e.item).children(
".k-link"
).text();
var menuItemOption2 = menuItems.Add().Text(child.Text).HtmlAttributes(
new
{@id=child.Oid.ToString()});
@model IList<ModelMenuItem>
@functions
{
public
void
addCategoryChildren(MenuItemBuilder builder,
string
parentCategory, IList<ModelMenuItem> items)
{
var children = items.Where(m => m.Category == parentCategory);
if
(children !=
null
)
{
builder.Items(menuItems =>
{
foreach
(var child
in
children)
{
var menuItemOption1 = menuItems.Add().Text(child.Text).Action(
"GetReports"
,
"Reports"
,
new
{Oid=child.Oid});
//var menuItemOption2 = menuItems.Add().Text(child.Text).HtmlAttributes(new {@id=child.Oid.ToString(), data-reportoid=child.Oid.ToString()});
}
});
}
}
}
@{
var categories = Model.Select(x => x.Category).Distinct().ToList();
}
<div id=
"workflowToolbar"
>
@(Html.Kendo().Menu()
.Name(
"mnuReports"
)
.Items(topMenu =>
{
foreach
(var cat
in
categories)
{
var builder= topMenu.Add().Text(cat.ToString());
addCategoryChildren(builder, cat.ToString(), Model);
}
})
.Events(e=>e.Select(
"reportSelectChanged"
))
)
</div>
@(Html.Kendo().Grid<EmployeeVM>().Name(
"grid"
)
.Columns(columns => {
columns.Bound(model => model.Id).Hidden(
true
);
columns.Bound(model => model.First);
columns.Bound(model => model.Email);
})
.Groupable(y => y.Enabled(
true
))
.Sortable(x => x.SortMode(GridSortMode.MultipleColumn))
.Pageable(x => x.PageSizes(
true
).Messages(messages => messages.Empty(
""
)))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.Model(model => model.Id(p => p.Id))
.Read(read => read.Action(
"List"
,
"Employee"
).Type(HttpVerbs.Post)))
...
"dataSource"
:{
"type"
:(function(){
if
(kendo.data.transports[
'aspnetmvc-ajax'
]){
return
'aspnetmvc-ajax'
;}
else
{
throw
new
Error(
'The kendo.aspnetmvc.min.js script is not included.'
);}})()
...