Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to active a tab in kendo ui angular 2 programmatically

Kendo UI angular 2 TabStripComponent has a method selectTab. How can I use it to active a tab from the typescript code?

like image 520
Stanley Chen Avatar asked Jan 18 '26 10:01

Stanley Chen


1 Answers

You can use the selectTab(index) method from the tabstrip component.

First, add a selector to your tabstrip in your view component:

<kendo-tabstrip #tabstrip>... </kendo-tabstrip>

Now, you can access the tabstrip from your module via

@ViewChild('tabstrip') public tabstrip: TabStripComponent;

Finally, you can activate any tab using its index with

tabstrip.selectTab(index);

Here is a Plunker if you want to have a look.

Be aware that it will not switch if the targeted tab is disabled!

like image 129
Matthias Sommer Avatar answered Jan 21 '26 00:01

Matthias Sommer