Element: [Feature Request] Tree: append root node

Created on 11 May 2018  ·  4Comments  ·  Source: ElemeFE/element

Existing Component

Yes

Component Name

Tree

Description

There should be easy way to append root (top level) node. Maybe reuse append method and if second parameter (parentNode) is empty - then append to top level.

Most helpful comment

i solved this by add tree level 0 to root:

this.$refs.myTree.root.data = []; // add empty array to root data
this.$refs.myTree.insertBefore({ id:10, name: 'abc'}, 1) // append node before node data id=1;

All 4 comments

Sorry, we have no plan to support this.

@Leopoldthecoder
Oh. I thought this should be easy to implement.

Then maybe at least there should be a method to reload the tree?

i solved this by add tree level 0 to root:

this.$refs.myTree.root.data = []; // add empty array to root data
this.$refs.myTree.insertBefore({ id:10, name: 'abc'}, 1) // append node before node data id=1;

@ahuang it works for me ,thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Zhao-github picture Zhao-github  ·  3Comments

yubo111 picture yubo111  ·  3Comments

smallpath picture smallpath  ·  3Comments

yorululu picture yorululu  ·  3Comments

akaylh picture akaylh  ·  3Comments