-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extract data from tree. #147
Comments
@atlantageek No there is no such API yet. Could you, please, describe your use case? Why do you need it back from a tree? |
@rychkog I don't know if @atlantageek use case is same as mine, but here it goes. Even if I refer the template with a name and try to access the tree model, I get the updated data of type Tree but not the TreeModel data |
Even I want to extract data from the dynamically created tree and store it in the database. Next time when I want to load the tree, I can pull the data from db which has latest updates and show it in the tree. |
@Anoop-Goudar This is how I did for now. I will add my code once I get back to office, which will be on Monday. Sorry for the delay. |
@Anoop-Goudar Could you, please, make a PR of your implementation? All the users will benefit from this |
@avadhootha, even I had started handling using event handlers. But it would be a great help if you add your code here. |
@Anoop-Goudar import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core'; @component({ settings: Ng2TreeSettings = { handleRemoved($event) { handleRenamed($event) { handleSelected($event) { handleMoved($event) { handleCreated($event) { handleExpanded($event) { handleCollapsed($event) { private emitTree() { private buildModelFromTree(tree) { Tree.component.html And use it like this wherever you need the tree Note that the tree inside the square brackets is wrapped with special brackets. This is for two-way binding As per the request of @rychkog I will create a PR in a few minutes for the same. Code might not be super clean but does the work and solves my use case. |
@avadhootha thank you 👍 |
@rychkog @Anoop-Goudar Here is the PR request #159 I am new to PR Requests, so ignore if there are any mistakes. |
Is there a function to extract data from the ng2-tree component.
The text was updated successfully, but these errors were encountered: