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

[Solved] separating tab strip from tab strip content

8 Answers 259 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Joseph
Top achievements
Rank 1
Joseph asked on 19 May 2011, 06:36 AM
Hi,

I am using the telerik tab strip and I would like to separate the ul containing the menu items from the divs that have the content.

ie. at the moment it renders like this:

<div id="tabstrip>
<ul id="tabstrip-items">
<li id="tab-1"></li>
</ul>
<div id="tab-1"></div>
</div>

I would like to be able to take the <ul> and put it in another div elsewhere on the page that will still change the content. Is this possible?

Best Regards,

Jay

8 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 19 May 2011, 06:45 AM
Hi Joseph,

You cannot use the Content method to separate the content this way. You can, however,
  1. have a TabStrip (without content) on the desired location of the page
  2. attach an event handler to the select event
  3. handle the change of the tab areas manually in the above event handler
This should result in your desired effect.

Regards,
Alex Gyoshev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Joseph
Top achievements
Rank 1
answered on 19 May 2011, 08:11 AM
Thank you for your prompt response.

I have instead made two tabstrips that link to each other, one with the content and a hidden strip, and one with the strip and (trying) to have no content.

How do I make a working strip with no content? I cannot pass Nothing to the .Content property.
I cannot even use css to hide divs as there is overwriting inline css that is being applied by jquery on the tabs.

Best Regards,

Joseph
0
John DeVight
Top achievements
Rank 1
answered on 19 May 2011, 01:47 PM
You could override the tabstrip.activateTab event for the instance of the tabstrip that should not display content as well as hide the div's.

If I had a tabstrip called "MyTabStrip" that had 3 tabs, this would be the code:

// Override the activateTab function to no longer display content.
$('#MyTabStrip').data('tTabStrip').activateTab = function(d) {
    var f = d.parent().children().removeClass("t-state-active").addClass("t-state-default").index(d);
    d.removeClass("t-state-default").addClass("t-state-active");
}

// Set the tabstrip height to the height of the tabs.
$('#MyTabStrip').height(25);

// Hide the contents for all the tabs.
$('#MyTabStrip-1').css('display', 'none')
$('#MyTabStrip-2').css('display', 'none')
$('#MyTabStrip-3').css('display', 'none')

Let me know how this turns out....

Regards,

John DeVight
http://aspnet.wikidot.com
0
John DeVight
Top achievements
Rank 1
answered on 19 May 2011, 05:27 PM
I've updated my telerik.extensions.js file to include new functions to hide and show content.

An example of hiding the content would be:

$('#MyTabStrip').data('tTabStrip').hideContent();

You can get the telerik.extensions.js file at: Telerik MVC : Extending the Client API

Regards,

John DeVight
http://aspnet.wikidot.com
0
nachid
Top achievements
Rank 1
answered on 19 May 2011, 06:59 PM
John,
What about a removeContent function?
Here is the code

$.telerik.tabstrip.removeContent= function()
{
    $('div.t-content', '.t-tabstrip' ).remove();
}
0
John DeVight
Top achievements
Rank 1
answered on 19 May 2011, 08:42 PM
I like it! =)
0
nachid
Top achievements
Rank 1
answered on 19 May 2011, 10:35 PM
You should then like this too! =)

$.telerik.tabstrip.toggleContent(showOrHide)
{
       $('div.t-content', '.t-tabstrip' ).toggle(showOrHide);
}

showOrHide is a Boolean indicating whether to show or hide the tabstrip content
It is the same used by jQuery toggle method
0
nachid
Top achievements
Rank 1
answered on 20 May 2011, 08:01 AM
Actually, I just discovered $contentElements property that should make things easier

// Remove tabstrip content
$.telerik.tabstrip.prototype.removeContent= function()
{
        this.$contentElements.remove();
}
 
// toggle tabstrip content
// showOrHide is a Boolean indicating whether to show or hide the tabstrip content
//It is the same used by the jQuery toggle method

$.telerik.tabstrip.prototype.toggleContent= function(showOrHide)
{
      this.$contentElements.toggle(showOrHide);
}

Example
var myTabstrip =$('#myTabstrip').data('tTabStrip');

// Hide tabstrip content
myTabStrip.toggleContent(false);

// Show tabstrip content back
myTabStrip.toggleContent(true);

//Remove for ever the tabstrip content
myTabStrip.removeContent();
Tags
TabStrip
Asked by
Joseph
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Joseph
Top achievements
Rank 1
John DeVight
Top achievements
Rank 1
nachid
Top achievements
Rank 1
Share this question
or