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

v0.8.4 chosenID autoexpand doesnt work #82

Open
B3NMP opened this issue Jan 16, 2024 · 3 comments
Open

v0.8.4 chosenID autoexpand doesnt work #82

B3NMP opened this issue Jan 16, 2024 · 3 comments

Comments

@B3NMP
Copy link

B3NMP commented Jan 16, 2024

I have the problem that when I pass a valid chosenId, the tree does the formatting for the active node but does not expand the path to the node.

Bildschirmfoto 2024-01-16 um 12 44 17
@btecu
Copy link
Owner

btecu commented Jan 16, 2024

Can you create a small reproduction or add a failing test?

@B3NMP
Copy link
Author

B3NMP commented Jan 17, 2024

Apparently no strings are accepted as valid IDs. Is it perhaps possible to get an update where strings are also accepted as IDs?

With chosenId = '3'
image

With chosenId = 3
image

Here is also the code i used:

Controller:
`import Controller from '@ember/controller';

export default class TreeController extends Controller {
chosenId = 3;

treeData = [
{
id: 0,
name: 'Root',
isExpanded: false,
isSelected: false,
isVisible: true,
children: [
{
id: 1,
name: 'First Child',
isExpanded: false,
isSelected: false,
isVisible: true,
children: [],
},
{
id: 2,
name: 'Second Child',
isExpanded: false,
isSelected: false,
isVisible: true,
children: [
{
id: 3,
name: 'First Grand Child',
isExpanded: false,
isSelected: false,
isVisible: true,
children: [],
},
],
},
],
},
];
}`

Template:
div XTree @model={{this.treeData}} @chosenId={{this.chosenId}} as |node| {{node.toggle}} {{node.model.name}} /XTree /div

@btecu
Copy link
Owner

btecu commented Jan 17, 2024

Strings are accepted, but your id values are not strings, that's likely the issue.
Either pass chosenId as a number or update your id to be strings.

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

2 participants