Hi,
How to put a scrollbar in a tree (so when it is expanded and goes below page end, it show a scorllbar) ?
Also is there a way to select a tree node programmatically,
for example make root node initially selected (and showing its children) ?
Please advise.
TIA,
Oleg.
Tree questions
-
- Posts: 1
- Joined: 09 Aug 2019, 08:13
Hi
I kept parentId in the children node and travel back from the desired selection to way up by using getNodeWithKey(node, nodelist) method and kept on expanding. I am not sure about how to get the scroll bar to move to the selection.
Regards
I kept parentId in the children node and travel back from the desired selection to way up by using getNodeWithKey(node, nodelist) method and kept on expanding. I am not sure about how to get the scroll bar to move to the selection.
Regards
-
- Posts: 10
- Joined: 02 Aug 2019, 23:58
I put the tree inside a scroll panel and that worked.
Here is a snippet:
Here is a snippet:
Code: Select all
<p-scrollPanel [style]="{width: '100%'}">
Content
<div class="content-section implementation">
<h3>Single Selection</h3>
<p-tree [value]="filesTree2" selectionMode="single" [(selection)]="selectedFile"
(onNodeSelect)="nodeSelect($event)" (onNodeUnselect)="nodeUnselect($event)"></p-tree>
<div style="margin-top:8px">Selected Node: {{selectedFile ? selectedFile.label : 'none'}}</div>
<h3>Horizontal Tree</h3>
<p-tree [value]="filesTree3" layout="horizontal" selectionMode="single" [(selection)]="selectedFile3" ></p-tree>
<div style="margin-top:8px">Selected Node: {{selectedFile3 ? selectedFile3.label : 'none'}}</div>
........
-
- Posts: 10
- Joined: 02 Aug 2019, 23:58
The Tree demo shows an example of programmatic select, expand, collapse.
It is the tenth one down: Programatic Tree Expansion
It is the tenth one down: Programatic Tree Expansion
-
- Information
-
Who is online
Users browsing this forum: No registered users and 13 guests