【问题标题】:Kendu Menu from XML in ASP.NET MVC来自 ASP.NET MVC 中 XML 的 Kendu 菜单
【发布时间】:2018-06-22 07:34:42
【问题描述】:

我有 XML 数据源,需要使用 ASP.NET MVC 创建剑道菜单。请帮忙!

德内什

【问题讨论】:

  • 请发布一些代码和 XML 示例,以便更容易为您提供帮助。你会得到什么错误/错误。

标签: xml model-view-controller kendo-ui menu


【解决方案1】:

实现动态生成的 Kendo UI 菜单小部件的唯一方法是使用 Kendo 数据源对其进行初始化。您可以将 JavaScript 对象数组或远程 XML、JSON、JSONP 数据绑定到 DataSource,然后动态初始化 Kendo UI 菜单。

这里是一个例子:http://jsfiddle.net/D54eM/

以下是数据的示例:

var menu1 =
[{
    text: "Company Name",
    cssClass: "ob-blue",
 }, 
 {
    text: "Customer's Name",
    cssClass: "light",
    items: [
       { text: "Mike Hunt" },
       { text: "Ben Dover" },
       { text: "Harry Cox" },
       { text: "Jack Goff" }
     ]
}, 
{
    text: "Color",
    cssClass: "dark",
    items: [
       { text: "Black" },
       { text: "White" },
       { text: "Blue" },
       { text: "Red" }
    ]
}, 
{
    text: "Prices",
    cssClass: "light",
    items: [
      { text: "$20,000" },
      { text: "$50,000" },
      { text: "$100,000" },
      { text: "150,000" }
    ]
}, 
{
    text: "Brand",
    cssClass: "dark",
    items: [
       { text: "Ford" },
       { text: "Chevrolet" },
       { text: "Audi" },
       { text: "Honda" }
     ]
}, 
{
    text: "Year",
    cssClass: "light",
    items: [
       { text: "2008" },
       { text: "2012" },
       { text: "2013" },
       { text: "2014" }
    ]
}, 
{
    text: "Miles",
    cssClass: "dark",
    items: [
       { text: "10" },
       { text: "10,000" },
       { text: "45,000" },
       { text: "80,000" }
]
}];

以下链接提供了一些有关 Kendo 数据源的有用文档:

http://docs.telerik.com/kendo-ui/getting-started/framework/datasource/overview

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多