【问题标题】:Kendo TabStrip: Getting the Selected Index on the Selected event (MVC 4)Kendo TabStrip:获取选定事件的选定索引(MVC 4)
【发布时间】:2013-03-16 19:02:59
【问题描述】:

我的 TabStrip 如下:

        @(Html.Kendo().TabStrip()
              .Name("tabApplications")
              .Items(items =>
                  {
                      items.Add().Text("Online").Selected(true);
                      items.Add().Text("Trading");
                  })
              .Animation(false)
              .Events(e=>e.Select("tabstrip_select"))
              )

在 Javascript 中,我得到了所选项目:

     function tabstrip_select(e) {
         var x = e.item;
     }

问题:我如何从这个函数中获得选定索引(即“1”)。我查看了 Item 对象,但没有看到任何明显的东西。

【问题讨论】:

    标签: asp.net asp.net-mvc telerik kendo-ui


    【解决方案1】:

    您可以通过在$(e.item) 上调用index() 来获取当前选定的索引

    function tabstrip_select(e) {
        var x = e.item;
        var selectedIndex = $(e.item).index();
    }
    

    使用JSFiddle进行演示。

    【讨论】:

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