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

[Solved] Node text wrapping

5 Answers 350 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Matthew Erwin
Top achievements
Rank 1
Matthew Erwin asked on 17 Jan 2008, 06:03 PM

When text needs to wrap within a tree view it is leaving empty space next to the node image and putting the text on the next line...e.g.

[img] Parent Node
      [img] Child Node
      [img] Child Node
      [img]
      Child Node with very long text that woul
      cause wrapping.
This doesn't present very well and is the result of placing the TreeView within any container that constrains the width of the tree (e.g. Div with overflow:auto).

This could be resolved if Telerik would put the <span> tag inside the <div> tag that contains the image instead of outside it...here is the code you generate today:
<div class="rtBot" style="border: 0px none black;">
<div class="rtAux">
<img class="rtImg"
src="/mx/images/minicons/folder_images.gif"
 alt=""/>
</div>
<span class="rtIn">
Child Node with very long
text that would cause wrapping.</span>
</div>
Here is the code that would act properly:
<div class="rtBot" style="border: 0px none black;">
<div class="rtAux">
<img class="rtImg"
src="/mx/images/minicons/folder_images.gif"
 alt=""/>
<span class="rtIn">
Child Node with very long text
that would cause wrapping.</span> </div> </div>
.rtImg and rtIn are both defined with float: left so the resulting presentation would be:
[img] Parent Node
      [img] Child Node
      [img] Child Node
      [img] Child Node with very long text that would
            cause wrapping.
...which at least in my opinion is more aesthetically pleasing and is the generally expected behavior of a tree view when wrapping is required.

Thanks for your time and consideration of the matter.


5 Answers, 1 is accepted

Sort by
0
Dimitar Milushev
Telerik team
answered on 18 Jan 2008, 09:44 AM
Hi Matthew Erwin,

Have you tested this scenario with the recently released service pack of the Prometheus suite? The Treeview html was changed slightly and better text wrapping was one of the reasons for the changes.

Kind regards,
Dimitar Milushev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Matthew Erwin
Top achievements
Rank 1
answered on 22 Jan 2008, 12:18 AM
Works perfectly with the latest minus 15px of padding that the new CSS is adding...I was able to eliminate that with the following added inline:

.radtreeview .rtUL .rtUL
{padding-left:0px !important; }

Thanks for the update!

0
Michael Dunbar
Top achievements
Rank 2
answered on 06 Feb 2008, 12:13 PM
Sorry if I am being thick here, but how do you make the text wrap in the new version of the tree? Is there a proprty on the tree I am missing or do you have to do something specific with the HTML/CSS?

Thanks,

Michael
0
Nikolay
Telerik team
answered on 06 Feb 2008, 03:05 PM
Hi Michael Dunbar,

The text of the TreeNodes can be easily wrapped when needed. For example, if the value applied to the RadTreeView's Width property is smaller than the width of the nodes.

You can apply style="white-space:normal" directly to the node or the entire treeview.

If you apply style="white-space:normal" to the whole treeview, each node's text will be wrapped when its width exceeds the width of the treeview.

Example:

<telerik:RadTreeView
    ID="RadTreeView1"
    runat="server"
    LoadingStatusPosition="BeforeNodeText"
    Width="200px">
   <Nodes>
       <telerik:RadTreeNode runat="server" ExpandMode="ClientSide" Text="Root RadTreeNode1 Root RadTreeNode1" style="white-space:normal">
       </telerik:RadTreeNode>
       <telerik:RadTreeNode runat="server" ExpandMode="ClientSide" Text="Root RadTreeNode2">
       </telerik:RadTreeNode>
       <telerik:RadTreeNode runat="server" ExpandMode="ClientSide" Text="Root RadTreeNode3">
       </telerik:RadTreeNode>
   </Nodes>
   <CollapseAnimation Duration="100" Type="OutQuint" />
   <ExpandAnimation Duration="100" Type="OutQuart" />
</telerik:RadTreeView>


Greetings,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Michael Dunbar
Top achievements
Rank 2
answered on 06 Feb 2008, 03:51 PM
That's great thanks.
Tags
TreeView
Asked by
Matthew Erwin
Top achievements
Rank 1
Answers by
Dimitar Milushev
Telerik team
Matthew Erwin
Top achievements
Rank 1
Michael Dunbar
Top achievements
Rank 2
Nikolay
Telerik team
Share this question
or