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

How to loop tabstrip tab selection using KendoUI ?

4 Answers 756 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Marko
Top achievements
Rank 1
Marko asked on 17 Jan 2012, 06:28 PM
Hi all,

I have following function in asp.net AJAX application. Function is fired by timer (30 sec interval) and it loops all tabs. Now I wonder if this is possible to implement with KendoUI?

Current implementation in ASP.NET AJAX:
function SelectTab()
{
    var tabstrip = $find("tabstrip1");
    var nextIndex = (tabstrip.get_selectedIndex() + 1)
    if (nextIndex >= tabstrip.get_tabs().get_count()) nextIndex = 0;
    tabstrip.set_selectedIndex(nextIndex);
}

I have tried something like this:

var tabstrip = $("#tabstrip").kendoTabStrip;
var selectedIndex = tabstrip.select().index();
var nextIndex = selectedIndex + 1;
//HOW TO FIND OUT IF SELECTED TAB IS LAST ONE?
//HOW TO SELECT TAB BY INDEX?


Any ideas?

BR
Marko

4 Answers, 1 is accepted

Sort by
0
Kamen Bundev
Telerik team
answered on 18 Jan 2012, 05:56 PM
Hello Marko,

You don't need the tab index to cycle through the tabs. Something like this will suffice:
var tabstrip = $("#TabStrip1").data("kendoTabStrip");
var nextItem = tabstrip.select().next();
if (nextItem.length)
    tabstrip.select(nextItem);
else
    tabstrip.select(tabstrip.tabGroup.children().first());


Regards,
Kamen Bundev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Marko
Top achievements
Rank 1
answered on 18 Jan 2012, 08:44 PM
Hi,

With following code (using api.htm example) I can select tabs from first to last, but for some reason selecting the first tab fails after last tab is selected. Error is thrown: object does not support method select or something like that.....

     var tabStrip = $("#tabstrip").kendoTabStrip().css({ marginRight: "220px" }).data("kendoTabStrip");
 
                    $(".NextTab").click(function (e) {
                        var tab = tabStrip.select(),
                        nextTab = tab.next();
                        if (nextTab.length)
                            tabStrip.select(nextTab);
                        else
//                            tabstrip.select(tabStrip.tabGroup.children("li:first"));
//                            tabstrip.select(tabStrip.tabGroup.children().first());

 
BR
Marko
0
Accepted
Kamen Bundev
Telerik team
answered on 23 Jan 2012, 09:27 AM
Hi Marko,

Javascript is a case-sensitive language and your tabStrip variable is using camel-case, while you are trying to access it with lowercase.

Kind regards,
Kamen Bundev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jayalakshmi
Top achievements
Rank 1
answered on 22 Mar 2012, 10:03 AM
Dear All,

I am using both Kendo tabstrip(with 3 Tabs) and Kendo Window.
In second Tabstrip I can open a Kendo window
Once the Kendo window is opened and if we switch from one tab to another ,  Kendo window doesn't close.
How can this scenario be resolved???

     waiting for your reply.
     Thanks in Advance
Tags
TabStrip
Asked by
Marko
Top achievements
Rank 1
Answers by
Kamen Bundev
Telerik team
Marko
Top achievements
Rank 1
Jayalakshmi
Top achievements
Rank 1
Share this question
or