Using append and select

2 posts, 0 answers
  1. Ryan
    Ryan avatar
    60 posts
    Member since:
    Mar 2012

    Posted 25 Jan 2013 Link to this post

    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?
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 29 Jan 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
Back to Top