我的 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 对象,但没有看到任何明显的东西。
最佳答案
您可以通过在 index()
上调用 $(e.item)
来获取当前选择的索引
function tabstrip_select(e) {
var x = e.item;
var selectedIndex = $(e.item).index();
}
使用 JSFiddle 进行演示。
关于asp.net - 剑道 TabStrip : Getting the Selected Index on the Selected event (MVC 4),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15646308/