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

Setting initially selected tab on TabStrip

2 Answers 1941 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 27 Feb 2013, 05:48 PM
Is there a way to select which tab to initially select when creating the KendoTabStrip?  I would like to optionally start on the 2nd or 3rd tab when the page loads (without loading the content from the first tab at all).  Is this possible?

2 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 01 Mar 2013, 12:00 PM
Hi Ryan,

Yes, you could achieve this. You just have to add the k-state-active class to the item, that you want to be initially selected.

E.g.
<ul>
    <li>First Tab</li>
    <li>Second Tab</li>
    <li class="k-state-active">Third Tab</li>
</ul>

 

Kind regards,
Dimiter Madjarov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Chris
Top achievements
Rank 1
Veteran
Iron
Iron
commented on 03 Jan 2023, 08:09 AM

Useless : 

 

<div id="tabstrip">
    <ul>
        <li>Tab 1</li>
        <li class="k-state-active">Tab 2</li>
    </ul>
    <div>Content 1</div>
    <div>Content 2</div>
</div>

<script>
    var tabStrip = $("#tabstrip").kendoTabStrip().data("kendoTabStrip");
 

    selectedItem = tabStrip.select(); // <--------- return length = 0 

 

     
Neli
Telerik team
commented on 05 Jan 2023, 06:39 AM

Hi Chris,

The select method returns the currently selected tab. Thus, length will be 0 in case there is no selected tab in the TabStrip.

You can check the Dojo linked here when a tab is selected, and the button is clicked the result has length 1.

Let me know in case you have additional questions.

Regards,

Neli

0
Andrew
Top achievements
Rank 1
Iron
Iron
answered on 13 Jun 2023, 11:04 PM | edited on 13 Jun 2023, 11:04 PM
Note that, since 2022.2, you no longer add the class k-state-active on the initially selected tab. Instead, you add the class k-active.

Neli
Telerik team
commented on 15 Jun 2023, 08:45 AM

Hi Andrew,

Indeed, the active class has been changed. Thank you for pointing that.

For convenience below is the list with the updated Kendo state classes.

- https://docs.telerik.com/kendo-ui/styles-and-layout/components-rendering-overview#state-classes

Regards,

Neli

Tags
TabStrip
Asked by
Ryan
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Andrew
Top achievements
Rank 1
Iron
Iron
Share this question
or