Get the tab index that contains a named element

6 posts, 2 answers
  1. Tyler
    Tyler avatar
    47 posts
    Member since:
    Nov 2013

    Posted 17 Sep 2015 Link to this post

    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);
        }
      }
    }

  2. Answer
    Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 21 Sep 2015 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. Tyler
    Tyler avatar
    47 posts
    Member since:
    Nov 2013

    Posted 24 Sep 2015 in reply to Petyo Link to this post

    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"));

  5. Tyler
    Tyler avatar
    47 posts
    Member since:
    Nov 2013

    Posted 24 Sep 2015 in reply to Tyler Link to this post

    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']"));

  6. Answer
    Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 28 Sep 2015 Link to this post

    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!
     
  7. Tyler
    Tyler avatar
    47 posts
    Member since:
    Nov 2013

    Posted 28 Sep 2015 in reply to Petyo Link to this post

    Thanks youre fiddle example was what i needed.
Back to Top
Kendo UI is VS 2017 Ready