This is a migrated thread and some comments may be shown as answers.

Programmatic selection of a Tabstrip Item shows wrong TabItem content

1 Answer 163 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Beth
Top achievements
Rank 1
Beth asked on 18 Jun 2013, 04:49 PM
Using the ASP.NET MVC wrappers, I have a tabstrip that loads it's respective tabitems contents from Html actions

@(Html.Kendo().TabStrip()
       .Name("inst_details_tabstrip")
       .Items(tabstrip => {
            tabstrip.Add().Text("Details").Content(@<text>@Html.Action("InstitutionDetails", "InstitutionSetup")</text>);
                       
            tabstrip.Add().Text("Locations").Content(@<text>@Html.Action("ServiceLocations", "InstitutionSetup")</text>);
                       
            tabstrip.Add().Text("Devices").Content(@<text>@Html.Action("Printers", "InstitutionSetup")</text>);
                       
            tabstrip.Add().Text("Users").Content(@<text>@Html.Action("UserList", "InstitutionSetup")</text>);
                       
        }))
This process works fine.  However, there is one case where when the page loads, the Users tab should be loaded by default rather than the Details tab.    

The following snippet will change the rendered state of the tabstrip to show the Users tab as selected, but will not switch to its corresponding contents (instead continues to show the Details tab content)


var tabstrip = $("#inst_details_tabstrip").data("kendoTabStrip");
tabstrip.select(tabstrip.tabGroup.find(':contains("Users")'));
var item = tabstrip.items()[3];
tabStrip.reload(item);
is there something simple I am missing?

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 20 Jun 2013, 02:31 PM
Hello,

The following selector:

tabstrip.select(tabstrip.tabGroup.find(':contains("Users")'));

matches two elements. One of them is the LI the other is the anchor inside.

You need to use the LI element.

Change your logic like this:

tabstrip.select(tabstrip.tabGroup.find('.k-item:contains("Users")'));

Also on the fourth line of JavaScript you typed the tabStrip with capital S and you do not actually need to call that reload.

Kind Regards,
Petur Subev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
TabStrip
Asked by
Beth
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or