Comments (19)
I intend to solve this by adding locators on the tree according to id /
path.
Also, need an "ensureVisible" method that expands and scrolls to it.
So will be able to do:
node = tree.findNodeById(id)
or
node = tree.findNodeByPath(['parent', 'child', 'leaf'])
and then:
node.toggleActivated();
node.ensureVisible();
What do you think?
On Tue, Aug 2, 2016 at 12:18 PM, Gillardo [email protected] wrote:
I am also looking for this functionality, this would be a great addition
to have.I have a list of folders that are being displayed in the treeview, i would
like to select the folder by id, and the treeview should automatically be
expanded to that node, with that node selected.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#22 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACUsQzcOdK5yWxoCSJkKq4VLUs9LVf3Kks5qbwtlgaJpZM4JYtrH
.
Adam Klein
CTO & Co-Founder
Tel. +972-52-747-5633
blog.500tech.com http://blog.500tech.com
meetup.com/angularjs-il
from angular-tree-component.
I am also looking for this functionality, this would be a great addition to have.
I have a list of folders that are being displayed in the treeview, i would like to select the folder by id, and the treeview should automatically be expanded to that node, with that node selected.
from angular-tree-component.
Yeah that should work fine. I aint to bothered about the findNodeByPath method, but i think the findByNode method is great. and then the ensureVisible and toggleActiviated are perfect to.
from angular-tree-component.
Can i be cheeky and ask....timescale?
from angular-tree-component.
I hope to work on it over the weekend.
There's quite a backlog of requests, so not entirely sure I'll make it.
P.S. This is an open source project, so feel free to implement it yourself
and do a Pull Request. Just let me know you're working on it.
On Tue, Aug 2, 2016 at 3:37 PM, Gillardo [email protected] wrote:
Can i be cheeky and ask....timescale?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#22 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACUsQ4d4QCNVatdXgNKAXj4_dQlqzqy0ks5qbzn-gaJpZM4JYtrH
.
Adam Klein
CTO & Co-Founder
Tel. +972-52-747-5633
blog.500tech.com http://blog.500tech.com
meetup.com/angularjs-il
from angular-tree-component.
I also think, that a method to remove a node by id, or by object should also be included with this. In our system, we have a list of pages, and if a page is removed, i would like to easily remove it from the treeview.
from angular-tree-component.
Noted.
I'm doing a refactor do make the tree binded directly to the nodes
structure.
So basically you could just remove the node from your data structure.
But I guess a utility function to remove a node will be nice.
On Wed, Aug 3, 2016 at 11:55 AM, Gillardo [email protected] wrote:
I also think, that a method to remove a node by id, or by object should
also be included with this. In our system, we have a list of pages, and if
a page is removed, i would like to easily remove it from the treeview.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#22 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACUsQytQEVU_ogS7nZMMklvz-J4-DWkoks5qcFebgaJpZM4JYtrH
.
Adam Klein
CTO & Co-Founder
Tel. +972-52-747-5633
blog.500tech.com http://blog.500tech.com
meetup.com/angularjs-il
from angular-tree-component.
I added a getNodeById
method to the treeModel (still undocumented).
Still haven't gotten to ensureVisible
method, but you can work that one by yourself in the meantime (just traverse up using parent
, and call toggleExpanded
).
from angular-tree-component.
Is this available on npm yet?
from angular-tree-component.
Yes, version 1.1.12
On Mon, Aug 8, 2016 at 11:19 AM, Gillardo [email protected] wrote:
Is this available on npm yet?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#22 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACUsQxMBjPzPXvE4Qmb4OSGwyw4aLGaEks5qduargaJpZM4JYtrH
.
Adam Klein
CTO & Co-Founder
Tel. +972-52-747-5633
blog.500tech.com http://blog.500tech.com
meetup.com/angularjs-il
from angular-tree-component.
Have you tried it? Did it work?
from angular-tree-component.
Not tried this yet, as everytime i do npm install --save
i do not get 1.1.12, but 1.1.10
from angular-tree-component.
Maybe u have the version fixed in package.json?
On Aug 9, 2016 17:52, "Gillardo" [email protected] wrote:
Not tried this yet, as everytime i do npm install --save i do not get
1.1.12, but 1.1.10—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#22 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA2SSgCtbzDUsaIPDSePpFb2drr632Jmks5qeJQRgaJpZM4JYtrH
.
from angular-tree-component.
Change to 1.1.12 and run npm update angular2-tree-component
On Tue, Aug 9, 2016 at 9:07 PM, adam klein [email protected] wrote:
Maybe u have the version fixed in package.json?
On Aug 9, 2016 17:52, "Gillardo" [email protected] wrote:
Not tried this yet, as everytime i do npm install --save i do not get
1.1.12, but 1.1.10—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://github.com/500tech/angular2-tree-component/
issues/22#issuecomment-238578470>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/
AA2SSgCtbzDUsaIPDSePpFb2drr632Jmks5qeJQRgaJpZM4JYtrH>
.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#22 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACUsQzYxGWdh7RJbYBPXEbQiVx1FxDMvks5qeMHugaJpZM4JYtrH
.
Adam Klein
CTO & Co-Founder
Tel. +972-52-747-5633
blog.500tech.com http://blog.500tech.com
meetup.com/angularjs-il
from angular-tree-component.
Cant get this to work...Think i need help. I have managed to get 1.1.13. My code is loading my folder using the ngOnInit method, and my folderId is being passed as an Input() to this component.
How can i set the node?
I have tried this, but findById always returns null
export class SaveComponent implements OnInit {
@ViewChild('tree')
tree: TreeComponent;
@Input()
report: IReport;
nodes: Folder[];
constructor(
private folderService: FolderService)
{ }
ngOnInit() {
this.folderService.getAll(null, '', true)
.then(result => this.nodes = result);
}
onInitialized($event) {
let node = this.tree.treeModel.getNodeById(this.report.folderId);
if (node)
node.toggleExpanded();
console.log(JSON.stringify(node));
}
// when page node is selected
onActivate(event) {
this.report.folderId = event.node.id;
}
}
My html to this component, is like so
<div class="col-md-3 m-b-1">
<a class="btn btn-outline-secondary m-b-1" (click)="alert('add folder coming soon')">Add New</a>
<Tree #tree [nodes]="nodes" (onActivate)="onActivate($event)" (onInitialized)="onInitialized($event)"></Tree>
</div>
What am i doing wrong?
from angular-tree-component.
Right got this to work, by changing some of my code, but it seems hacky.
First, i had to add *ngIf to my html, so it now looks like this
<div class="col-md-3 m-b-1" *ngIf="nodes">
<a class="btn btn-outline-secondary m-b-1" (click)="alert('add folder coming soon')">Add New</a>
<Tree #tree [nodes]="nodes" (onActivate)="onActivate($event)" (onInitialized)="onInitialized($event)"></Tree>
</div>
Then i changed the OnInitialized
function to this
onInitialized($event) {
setTimeout(() => {
let node = this.tree.treeModel.getNodeById(this.report.folderId);
if (node)
node.toggleActivated();
}, 0);
}
I personally think that the treeView needs some sort of onModelChanged event. So that you dont need to put a *ngIf around it, which means that you dont need the setTimeout
in the onIntitialized method either. So code would look like this
<div class="col-md-3 m-b-1">
<a class="btn btn-outline-secondary m-b-1" (click)="alert('add folder coming soon')">Add New</a>
<Tree #tree [nodes]="nodes" (onActivate)="onActivate($event)" (onModelChanged)="onModelChanged($event)"></Tree>
</div>
onModelChanged($event) {
let node = this.tree.treeModel.getNodeById(this.report.folderId);
if (node)
node.toggleExpanded();
}
What do you think?
from angular-tree-component.
Looking at your code, am i right in thinking you already have such an event called onUpdateData
but this is out available as an @Output
.
Any chance we could make this available as an output?
from angular-tree-component.
Yes I'll add.
That's a good point, I'll add *ngIf on nodes
On Wed, Aug 10, 2016 at 2:29 PM, Gillardo [email protected] wrote:
Looking at your code, am i right in thinking you already have such an
event called onUpdateData but this is out available as an @output.Any chance we could make this available as an output?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#22 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACUsQ0J-UtADp3PUgPeMdFO_v9grmTO-ks5qebYCgaJpZM4JYtrH
.
Adam Klein
CTO & Co-Founder
Tel. +972-52-747-5633
blog.500tech.com http://blog.500tech.com
meetup.com/angularjs-il
from angular-tree-component.
I'm closing this issue though
from angular-tree-component.
Related Issues (20)
- Missing documentation for how to use checkbox tri-state in a custom template HOT 2
- expandAll() method is very slow with large objects,even if virtual scroll is true HOT 1
- Typo in the template section of the documentation HOT 1
- selecting parent node does not select children with hasChildren true HOT 1
- No event for checkbox de-selection
- RTL doesn't work with Action Mapping
- Warning when publishing project in angular 14
- Select All option in tree view
- actionMapping mouse dblClick has stopped working HOT 1
- Expanding specific node on ngAfterViewInit
- Abandoned? HOT 1
- Add Expand/Collapse tooltips to expand/collapse arrows for better accessibility
- How to use whole new tree inside context menu HOT 1
- text while dragging node
- Module "@circlon/angular-tree-component" has no exported member 'IDTypeDictionary' HOT 1
- Angular 16 support HOT 23
- how can I know when the node is fully expanded?
- Solution: Low performance on scrolling. Performance boost
- NVDA screen reader reading blank sometimes
- System tree view is not displayed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-tree-component.