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

Using append and select

1 Answer 263 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 25 Jan 2013, 07:51 PM
If I append a tab I want to be able to select it by an ID or string instead of index. I tried passing an `id` property to my append data but had no luck. How can I do this?

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 29 Jan 2013, 09:27 AM
Hello Ryan,

Basically you can achieve this with a small work-around, since you are not able to set template for the header tab item (you can set content only for the content).
The idea is to set the encoded option to false and insert element which you can later find easily inside of the text option.
e.g.
var tabStrip = $("#tabstrip").data("kendoTabStrip");
tabStrip.append(
                        [{ text: "Tab 1<span id='"+'foo1'+"'/>",
                            encoded:false,
                            content: "<div id='tab1' style='height:100%'>test</div>"
                        }]);

Later on you can find and select the tab like this:
var tabToActivate = $("#foo1").closest('.k-item'); ;
tabStrip.select(tabToActivate);

I hope this helps.

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