Skip to content
This repository has been archived by the owner on Dec 7, 2019. It is now read-only.

Folding collapses whole tree (Angular) #32

Open
ghost opened this issue Apr 19, 2018 · 3 comments
Open

Folding collapses whole tree (Angular) #32

ghost opened this issue Apr 19, 2018 · 3 comments
Labels

Comments

@ghost
Copy link

ghost commented Apr 19, 2018

Hey,

first off, great work so far, I really like this component.

I'm not sure if I just don't get the strategies or if this is a bug.
I use the following strategies
strategies = { click: ['select', 'unfold-on-selection'], selection: ['single'], fold: ['no-child-selection', 'not-selected'] };
What kind of expected is that when I click on an unfolded item (expanded?!), that only this item gets collapsed/folded and not the whole tree.

But I also want to be able to use the activated route '.../item/{[id}' to use that id and select an item in the tree. I had a look at this issue Auto expand on load,
but I really had no idea how to use this within my component. So I choose to set the [selection] on my will at loading.

Am I missing something?

Thanks in advance :)

@elbywan
Copy link
Owner

elbywan commented Apr 21, 2018

Hi @lockemotive,

first off, great work so far, I really like this component.

Thanks 😄 !

What kind of expected is that when I click on an unfolded item (expanded?!), that only this item gets collapsed/folded and not the whole tree.

I'm not getting the 'whole tree' thing, clicking on an item should expand only this item's children, not every subtree below it. Do you get another behaviour ?

But I also want to be able to use the activated route '.../item/{[id}' to use that id and select an item in the tree. I had a look at this issue Auto expand on load,
but I really had no idea how to use this within my component. So I choose to set the [selection] on my will at loading.

This link was about expanding the whole tree (meaning all nodes) when displaying the component for the first time, then being able to use the '+' / '-' openers afterwards to control opening/closing individual nodes.

If your goal is to expand a single node then using those strategies with setting the selection yourself on load seems to be the good thing to do to me 😉.

fold: ['no-child-selection', 'not-selected'] means that an bosket will automatically collapse (fold) every node that is either not selected nor has a child selected.
If you set the selection array yourself containing the element related to the route '.../item/{[id}' then you should get this item and its parents expanded at load.

Also, click: ['unfold-on-selection'] is meant to be used in conjunction with fold: [ "opener-control"]. It registers a click on a node in the tree as a click on an opener. You can safely remove it.

@ghost
Copy link
Author

ghost commented Apr 23, 2018

Thanks for the response @elbywan ,

I'm not getting the 'whole tree' thing, clicking on an item should expand only this item's children, not every subtree below it. Do you get another behaviour ?

No, I guess I just misread the description and expected somehting else.

I'm using the following strategies now
'select', 'single', 'no-child-selection'..

fold: ['no-child-selection', 'not-selected'] means that an bosket will automatically collapse (fold) every node that is either not selected nor has a child selected.

The way the tree behaves with those 3 strategies is exactly what I want, execpt for the part where the tree folds itself after I deselect a node.
Even though the fold strategie descibes it that way, I didnt know what was happening the first time.
I just wanted the tree to stay in the current state and deselect my current node.

Or

Let's say I use 'opener-control' as fold strategy, all I want now is that when I select a node it also triggers the fold event.. So that I can set the [selection] so that every node above and all children of my selection are expanded.

Is either of the above possible without using a custom strategie that I have to set?
If not can you help me out? :) Hope I could clarify more.

@wangmeijian
Copy link

When can the official website have a complete configuration document?

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

No branches or pull requests

2 participants