can't programmatically select a tab

4 posts, 0 answers
  1. Dave
    Dave avatar
    2 posts
    Member since:
    Sep 2008

    Posted 21 Dec 2012 Link to this post

    this is the code I have.. I've tried both 
     
    tbs.select(1);

    and
      tbs.select(tabStrip.tabGroup.children("li:first"));
    .. neither work.

    var tbs = $("#mytabs").kendoTabStrip({
                          dataSource: {
                              transport: {
                                  read: {
                                      url: "api/data,
                                      dataType: "json"
                                  }
                              },
                          },
                       change: function(e) {
                           //some code
                       }
                      }).data("kendoTabStrip");
                   tbs.select(1);

  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 25 Dec 2012 Link to this post

    Hi Dave,

    On my side the selection is working fine. Here is jsbin which demonstrates your approach.

    http://jsbin.com/edamuj/208/edit

    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
  4. Dave
    Dave avatar
    2 posts
    Member since:
    Sep 2008

    Posted 03 Jan 2013 Link to this post

    Petur ... If I hardcode/pass a bunch of values into the datasource like in your example, it works.  When I use a dynamic datasource, it doesn't. 
    this works:
    var tbs = $("#mytabs").kendoTabStrip({
                          dataSource: {["2001","2002","2003"]},
                       change: function(e) {
                           //some code
                       }
                      }).data("kendoTabStrip");
                   tbs.select(1);


    this doesn't 
    var tbs = $("#mytabs").kendoTabStrip({
                          dataSource: {
                              transport: {
                                  read: {
                                      url: "api/data,
                                      dataType: "json"
                                  }
                              },
                          },
                       change: function(e) {
                           //some code
                       }
                      }).data("kendoTabStrip");
                   tbs.select(1);


    the JSON payload from my service is identical to what I hard coded.  Perhaps I should use the ContentLoad event? If so, how?
  5. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 04 Jan 2013 Link to this post

    Hello Dave,

    The TabStrip widget does not support a 'real' DataSource component with remote transport. I guess that you got mistaken by this demo but the dataSource in it is a standard JavaScript array.

    If you want to load external data, please use the Ajax loading feature (demo).
    I hope this will help.

    Kind regards,
    Alexander Valchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top
Kendo UI is VS 2017 Ready