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

Get the tab index that contains a named element

5 Answers 987 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Ruairi
Top achievements
Rank 1
Ruairi asked on 17 Sep 2015, 09:51 AM

I have a Tab strip with multiple tabs. Each tab has a number of named controls\elements.

I want to be programaticaly select the tab which contains a specific control\element name.

function setTabIndev(tabStripName, iTab, ctrHighlight)
{
  if ($('#' + tabStripName).length)
  {
    var tabStrip = $('#' + tabStripName).data('kendoTabStrip');
 
    //If 'ctrHighlight' is set then find tab control is on and select that tab else use 'iTab'
    if (ctrHighlight && $('#' + ctrHighlight).length) {
                    ???????????????
    }
    else {
      if(itab)
        tabStrip.select(iTab);
    }
  }
}

5 Answers, 1 is accepted

Sort by
0
Accepted
Petyo
Telerik team
answered on 21 Sep 2015, 08:13 AM

Hello Tyler,

Please check this example.

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Ruairi
Top achievements
Rank 1
answered on 24 Sep 2015, 03:03 PM

Unfortunately this dosnt work because I have a TabStrip control with multiple tabStrips. Each tabStrip can contain one or more PanelBar controls and the index is returning for the PanelBar index the control is on and not the tabStrip index.

I'm guessing I need to refine the closest selector something like below but this dosnt work?

var tabIndex = ts.find(".k-content[role='tabpanel']").index(ts.find("#myControlToLookFor").closest(".k-content"));

0
Ruairi
Top achievements
Rank 1
answered on 24 Sep 2015, 03:37 PM

The selector to get the tab ​index where there are tabStrips and panelBars mixed is as follows:

 

var tabIndex = ts.find(".k-content[role='tabpanel']").index(ts.find("#" + key).closest(".k-content[role='tabpanel']"));

0
Accepted
Petyo
Telerik team
answered on 28 Sep 2015, 08:30 AM

Hello Tyler,

 

I am not sure if you need further assistance with your setup. If this is so, may you please modify the sample I provided, so that it matches your case more closely? Thank you in advance. 

 

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Ruairi
Top achievements
Rank 1
answered on 28 Sep 2015, 09:10 AM
Thanks youre fiddle example was what i needed.
Tags
TabStrip
Asked by
Ruairi
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Ruairi
Top achievements
Rank 1
Share this question
or