liquor-tree icon indicating copy to clipboard operation
liquor-tree copied to clipboard

Find ROOT nodes

Open lon9man opened this issue 3 years ago • 0 comments

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??

lon9man avatar Dec 11 '20 17:12 lon9man