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

[Solved] How to hide section in client side?

4 Answers 117 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nim
Top achievements
Rank 1
Nim asked on 22 Jun 2011, 07:26 PM
Hello,

Say, if I have a panelbar with two sections, like "Part A" and "Part B" in the codes below:

<% Html.Telerik().PanelBar()
            .Name("PanelBar")
            .Items(
                parent => {
                   parent.Add()
                       .Text("Part A")
                       .Content(() => { %>
                        ** Part A contents **    
                    <% }).Expanded(true);
                   parent.Add()
                       .Text("Part B")
                       .Content(() => { %>
                        ** Part B contents **
                    <% }).Expanded(true);
}).Render(); %>
    
How can I hide "Part A" using Javascript. 

In the Javascript sample, I see "Collapse" and "Disable".
Can we completely hide the "Part A" section?
If not, any workaround? And any future plan to add this as a new feature?

Many thanks.

4 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 23 Jun 2011, 07:01 AM
Hello Nim,

 You can use the jQuery hide method to hide any part of the panelbar you want.

Regards,
Atanas Korchev
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
Nim
Top achievements
Rank 1
answered on 23 Jun 2011, 04:03 PM
Hello Atanas,

Based on your reply, it seems if I can use "hide()", I will need to create a "reference" that points to the PanelBar section that I want to hide.  Then I'll call the "hide()" function from the reference.  It may look at:

$("#Reference-to-PanelBar-Section-I-want-to-hide").hide();

Am I in the right direction? 
FYI, I've tried:

var panelBar = $("#PanelBar").data("tPanelBar");
var section = $("> li", panelBar.element)[0];
section.hide();    

This generates an error message - item.hide is not a function.  Am I missing something?
Based on the sample code in my first post, would you please provide the codes to demonstrate how "hide()" may work.

Thank you.
0
Dimo
Telerik team
answered on 24 Jun 2011, 05:46 AM
Hello Nim,

$("> li", panelBar.element)[0] returns a DOM element, while hide() is a method of a jQuery object. You can use

$("> li:first", panelBar.element)

to retrieve only one PanelBar item and keep it as a jQuery object.

Best wishes,
Dimo
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
Nim
Top achievements
Rank 1
answered on 07 Jul 2011, 06:57 PM
Thank you for your reply.
Yes, this solves my question.
Tags
PanelBar
Asked by
Nim
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Nim
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or