Я пытаюсь реализовать привязку меню Kendo UI из JSON данных.
Пока я получаю только ссылки со значением контроллера, основанным на моих JSON данных.
Например, я получаю это в href
href = "/ MemberManagement"
MemberManagement - это имя контроллера
Есть ли способ, которым я могу добавить контроллер с действием также
Вот код представления, который я использую
<script>
$(document).ready(function () {
$("#menu1").kendoMenu({ dataTextField: "TitleText", dataSource: { transport: { read: { url: "@Url.Action("GetMenuData", "Home")", dataType: "json" } }, schema: { model: { id: "id", hasChildren: "hasChildren", action: "Link" } } } })
$("#menu1").kendoMenu({
dataTextField: "TitleText",
dataSource: {
transport: {
read: {
url: "@Url.Action("GetList", "Test")",
dataType: "json"
}
},
schema: {
model: {
id: "id",
hasChildren: "hasChildren",
ActionName: "ActionName",
ControllerName:"ControllerName"
}
}
}
})
});
$("#menu1").kendoMenu({
select: onSelect
});
function onSelect(e) {
alert("Selected: " + $(e.item).children(".k-link").text());
alert("Selected: " + $(e.item.action).children(".k-link").text());
}
My JsonData
[{"id": "1", "ParentID": "0", "TitleText": "Веб-приложение", "ControllerName": "MemberManagement", "ActionName": "Index", "hasChildren ": true}, {" id ":" 59 "," ParentID ":" 0 "," TitleText ":" Приложение приложения "," ControllerName ":" MemberManagement "," ActionName ":" Index "," hasChildren " : true}, {"id": "62", "ParentID": "0", "TitleText": "Управляющее приложение", "ControllerName": "MemberManagement", "ActionName": "Index", "hasChildren": true}, {"id": "63", "ParentID": "0", "TitleText": "Test 15De c", "ControllerName": "MemberManagement", "ActionName": "Index", "hasChildren ": true}, {" id ":" 68 "," ParentID ":" 0 "," TitleText ":" Водительские права "," ControllerName ":" MemberManagement "," ActionName ":" Index "," hasChild жэнь ": истинно}, {" ID ":" 69" , "ParentID": "0", "TitleText": "Тарик-Jan-04-2020", "ControllerName": "MemberManagement", "ActionName":» Index "," hasChildren ": true}, {" id ":" 71 "," ParentID ":" 0 "," TitleText ":" родительский узел "," ControllerName ":" MemberManagement "," ActionName ":" Index "," hasChildren ": true}, {" id ":" 75 "," ParentID ":" 0 "," TitleText ":" Rheem Do c "," ControllerName ":" MemberManagement "," ActionName ": "Index", "hasChildren": true}, {"id": "80", "ParentID": "0", "TitleText": "Портал участника", "ControllerName": "MemberManagement", "ActionName": " Индекс», "HasChildren": истинный}]