简体   繁体   English

Kendo Tabstrip单击事件仅触发一次

[英]Kendo Tabstrip click event fired only once

I am using kendo tabstrip having two tabs. 我正在使用具有两个选项卡的kendo选项卡。

Tab I: Add User. 选项卡I:添加用户。 Tab II: It has a dropdown that will be refreshed every time when a user is added from Tab1 标签II:它具有一个下拉菜单,每次从Tab1添加用户时都会刷新

I need to call a javascript method to refresh the drop down of Tab II each time it is called. 每次调用Tab II时,我都需要调用一个javascript方法来刷新Tab II的下拉菜单。 I have used tabstrip "Activate","Select","Show" events but it is only firing once while the tab is clicked. 我使用过Tabstrip“激活”,“选择”,“显示”事件,但是在单击该选项卡时仅触发一次。

     @(Html.Kendo().TabStrip()
    .Name("CWUserTabStrip")
.Events(events => events            
            .Activate("onActivate")
.Select("onSelect")
.ContentLoad("onContentLoad")

        )
    .Items(tabstrip =>
    {
        tabstrip.Add().Text("User Creation")
            .Selected(true)
            .LoadContentFrom("_CWUserCreationTab", "User");

        tabstrip.Add().Text("User Allocation")
            .LoadContentFrom("_CWUserAllocationTab", "User");

    })
)

Any trick to fire the tabstrip click event each time a tab is clicked ?? 每次单击选项卡时触发选项卡单击事件的任何技巧?

I think you can attach your own event with jquery: 我认为您可以使用jQuery附加自己的事件:

$(function () {
    $("div#CWUserTabStrip ul li:nth-child(2)").on("click", function () {
        alert('clicked');
    });
});

You can put this in the view where the tab strip is, just make sure you set the child element corresponding to the tab number in your tab strip. 您可以将其放在标签条所在的视图中,只需确保设置与标签条中标签号相对应的子元素。 I tested it and it works nicely. 我测试了它,效果很好。 Check it out. 看看这个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM