Select a tab with a button click

2 posts, 0 answers
  1. Kimberly
    Kimberly avatar
    1 posts
    Member since:
    Aug 2012

    Posted 02 Aug 2012 Link to this post

    Hi All,
        I would like a button click on my page to programattically open a tab.

      // bind event for button

    $("#btnShowMyTab").click( function(e) { 

    var tabstrip = $("#informationTabstrip").kendoTabStrip().data("kendoTabStrip");

    var myTab = tabstrip.tabGroup.children("li").eq(2);

    // activate fact tab

        tabstrip.select(myTab);

    });

    The problem I am having is that for a split second, the tab I want to see shows up, but it is immediately replaced by whichever tab was open before I clicked the button.  The open tab I want does not stay open.

    Does anyone see anything wrong with my click event ?

    Thank you,
    Kim

  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2895 posts

    Posted 07 Aug 2012 Link to this post

    Hello Kimberly,

    At the click event of the btnShowMyTab button the tapStrip component is initialized again, which is causing the unexpected behaviour that you have described. The widget client object is preserved in the jQuery data store for the corresponding element. The following code snippet shows how to get the client object of the tabStrip.
    var tabstrip = $("#informationTabstrip").data("kendoTabStrip");

    For convenience I prepared a small example where you can see a working version of your code.
    I hope this helps.

    Regards,
    Alexander Valchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top