Skip to content
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

onExpand/onCollapse callback #26

Open
jandillmann opened this issue Sep 7, 2019 · 3 comments
Open

onExpand/onCollapse callback #26

jandillmann opened this issue Sep 7, 2019 · 3 comments

Comments

@jandillmann
Copy link

I'd like to store the tree's state (expanded, collapsed) in local storage, but I don't think there are callbacks for these events yet. Would it be possible to add these, or is there another way to achieve this?

@btecu
Copy link
Owner

btecu commented Sep 8, 2019

In your parent component that uses x-tree, you could save the state when you're about to destroy the component / leave the route. That way, you don't have to update your localStorage after every single change but in bulk. Use the isExpanded property. That should, work, correct?

@jandillmann
Copy link
Author

Thank you for this suggestion, however I don't think it's a solution for my usage.
The tree component is shown on the left of the Ember app as a navigation sidebar and visible at all times, so the website (tab / browser window) is much more likely to be closed than being navigated away from.
Additionally, users can add new elements to the tree, which currently reloads the whole model and therefore renders a new tree with the newly inserted element. This also resets the isExpanded properties, i.e. all collapsed elements then suddenly expand again.

@lodrantl
Copy link

lodrantl commented Apr 1, 2020

Could also be useful to implement tree lazy loading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants