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

Selecting a tab at the 2nd level doesn't change the view

3 Answers 49 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Stuart Hemming
Top achievements
Rank 2
Stuart Hemming asked on 11 Jun 2012, 11:32 AM
I have a tab strip defined like this ...
<telerik:RadTabStrip runat="server"
                     ID="RadTabStrip1"
                     MultiPageID="RadMultiPage1"
                     ScrollChildren="true"
                     ScrollButtonsPosition="Right"
                     PerTabScrolling="true"
                     SelectedIndex="0">
    <Tabs>
        <telerik:RadTab Value="tsSearch"
                        Text="Search"
                         ScrollChildren="true"
                         ScrollButtonsPosition="Right"
                         PerTabScrolling="true">
            <Tabs>
                <telerik:RadTab Value="tsSearchBasic"
                                Text="Quick"
                                PageViewID="pvSearchBasic"/>
                <telerik:RadTab Value="tsSearchAdvanced"
                                Text="Advanced"
                                PageViewID="pvSearchAdvanced"/>
            </Tabs>
        </telerik:RadTab>
        <telerik:RadTab Value="tsDetails"
                        Text="Details"
                         ScrollChildren="true"
                         ScrollButtonsPosition="Right"
                         PerTabScrolling="true">
            <Tabs>
                <telerik:RadTab Value="tsBusiness"
                                Text="Business"
                                PageViewID="pvBusiness"/>
                <telerik:RadTab Value="tsPersonal"
                                Text="Personal (Phone/Email)"
                                PageViewID="pvPersonal"/>
                <telerik:RadTab Value="tsPostal"
                                Text="Personal (Address)"
                                PageViewID="pvPostal"/>
            </Tabs>                
        </telerik:RadTab>
    </Tabs>
</telerik:RadTabStrip>

Now, if I have a 2nd-level tab on tsDetails selected and run this fowllowing javascript ...

startTab = tabStrip.findTabByValue("tsSearchBasic");
if (startTab != null)
{
    startTab.select();
    startTab.scrollIntoView();
}

What happens is that the relevant PageView shows, suggesting that the correct tab has been selected. However, the tabstrip itself doesn't change.

Rightly or wrongly, I was expecting the top-level tab "Search" to be come active and the relevant 2nd-level tab to be selected.

Either I'm doing it wrong, my expectations are incorrect or it's broken.

Anyone care to hazard a guess?

[later]
I suspect my expectations are wrong  :-( as it works as I've described on this demo page too.



3 Answers, 1 is accepted

Sort by
0
Stuart Hemming
Top achievements
Rank 2
answered on 11 Jun 2012, 12:04 PM
On the assumption that I had set an unreasonable level of expectation, I modified my code to read ...
startTab = this.tabStrip.findTabByValue("tsSearchBasic");
// ...
if (startTab != null)
{
    if (startTab.get_level() > 0)
    {
        startTab.get_parent().select();
        startTab.get_parent().scrollIntoView();
    }
    startTab.select();
    startTab.scrollIntoView();
    if (startTab.get_level() == 0)
    {
        if (startTab.get_tabs().get_count() > 0)
        {
            startTab.get_tabs().getTab(0).select();
        }
    }
}

If anyone finds themself with a simlar problem.

I still think that expecting the hierarchical view of the tabs to change when you programmatically select a lower-level tab is a valid one though.
--
Stuart

0
Accepted
Kevin
Top achievements
Rank 2
answered on 11 Jun 2012, 12:51 PM
Hello Stuart,

Apparently there is also a selectParents() method that you use to select all parent tabs for a selected RadTab object. So you could just call, startTab.selectParents(), instead of checking the level to determine if the parent should be selected.

This method exists in the latest version of the controls, at least the ones used on the demo pages, so I'm not sure if it would be available with the version you're using.
0
Stuart Hemming
Top achievements
Rank 2
answered on 11 Jun 2012, 01:23 PM
Thanks Kevin,

That call's not in the docs (at least not the .chm version).

Modified my code to suit.

Thanks again.

--
Stuart
Tags
TabStrip
Asked by
Stuart Hemming
Top achievements
Rank 2
Answers by
Stuart Hemming
Top achievements
Rank 2
Kevin
Top achievements
Rank 2
Share this question
or