Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 604
Ian Vink Avatar asked Dec 11 '22 16:12

Ian Vink


1 Answers

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.

like image 200
nemesv Avatar answered Dec 29 '22 11:12

nemesv