Kendo TabStrip:获取 Selected 事件的 Selected 索引 (MVC 4) [英] Kendo TabStrip: Getting the Selected Index on the Selected event (MVC 4)

查看:68
本文介绍了Kendo TabStrip:获取 Selected 事件的 Selected 索引 (MVC 4)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 TabStrip 如下:

My TabStrip is as follows:

        @(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 中,我得到了所选项目:

In Javascript I get theSelected Item:

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

问题:如何从该函数中获取选定索引(即1").我查看了 Item 对象,但没有看到任何明显的东西.

Question: How do I get the Selected Index (ie "1") from this function. I looked over the Item object but didn't see anything obvious.

推荐答案

您可以通过在 $(e.item)index() 来获取当前选择的索引>

You can get the currently selected index with calling index() on the $(e.item)

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

使用 JSFiddle 的演示.

这篇关于Kendo TabStrip:获取 Selected 事件的 Selected 索引 (MVC 4)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆