Kendo TabStrip: Getting the Selected Index on the Selected event (MVC 4)

浪尽此生 提交于 2019-12-06 06:00:22

问题


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"))
              )

In Javascript I get theSelected Item:

     function tabstrip_select(e) {
         var x = e.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.


回答1:


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();
}

Demo using JSFiddle.



来源:https://stackoverflow.com/questions/15646308/kendo-tabstrip-getting-the-selected-index-on-the-selected-event-mvc-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!