【问题标题】:How to create dynamic Kendo TabStrip tabs如何创建动态 Kendo TabStrip 选项卡
【发布时间】:2020-03-16 08:13:50
【问题描述】:

我有带有侧边菜单和内容的网站。里面的内容我有 Tabstrip,我有一个默认选项卡。

我只想在选择一项而不是打开新视图时添加动态选项卡我想显示新选项卡 里面的内容。

有可能吗?

这是我在 Layout 中的 Tabstrip

 @(Html.Kendo().TabStrip()
   .Name("tabstrip-layout").SelectedIndex(0)
    .Items(tabstrip =>
     {   tabstrip.Add().Text("General").ImageUrl("~/assets/images/icons/general.svg")
         .Content(@<text>
            @RenderBody()
         </text>);
 }))

【问题讨论】:

    标签: javascript c# asp.net-mvc kendo-ui kendo-asp.net-mvc


    【解决方案1】:

    我在剑道文档中找到了我的问题答案。如果你想动态添加新标签,你可以使用append函数

    https://docs.telerik.com/kendo-ui/api/javascript/ui/tabstrip/methods/append

    这是一个例子

    $("#tabstrip-layout").kendoTabStrip();
    
    var tabstrip = $("#tabstrip-layout").data("kendoTabStrip");
    tabstrip.append({
            text: "New "tab,
            encoded: false,
            contentUrl: "../Home/Default",
            imageUrl: 'assets/images/icons/general.svg',
        });
    

    【讨论】:

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