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

can't programmatically select a tab

3 Answers 461 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 22 Dec 2012, 02:37 AM
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);

3 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 25 Dec 2012, 07:44 AM
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!
0
Dave
Top achievements
Rank 1
answered on 03 Jan 2013, 10:00 PM
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?
0
Alexander Valchev
Telerik team
answered on 04 Jan 2013, 05:48 PM
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!
Tags
TabStrip
Asked by
Dave
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Dave
Top achievements
Rank 1
Alexander Valchev
Telerik team
Share this question
or