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

Find ROOT nodes #227

Open
lon9man opened this issue Dec 11, 2020 · 0 comments
Open

Find ROOT nodes #227

lon9man opened this issue Dec 11, 2020 · 0 comments

Comments

@lon9man
Copy link

lon9man commented Dec 11, 2020

i am trying to use tree API to find root nodes.
BUT i didn't get correct results

EXAMPLE DATA

[
            { text: 'Item 1' },
            { text: 'Item 2', state: { expanded: true }, children: [
                { text: 'Item 2.1' },
                { text: 'Item 2.2' },
                { text: 'Item 2.3' }
            ]},
            { text: 'Item 3', state: { selected: true } },
            { text: 'Item 4' }
]

https://jsfiddle.net/longman/dqf1wLsp/4/

WHAT i USE
this.$refs.tree.find({depth: 0})
OR
this.$refs.tree.find({parent: null})

WHAT i GET
i get ALL nodes (7 nodes)

WHAT i EXPECT
return top level of nodes (4 nodes)

QUESTIONS:
it works when i use find using criteria with text prop.
BUT WHY i am unable to find nodes using criteria wit depth/parent props??

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

1 participant