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

大佬 请问怎么在指定节点下添加一条数据 #16

Open
sfy666666 opened this issue Jul 29, 2020 · 2 comments
Open

大佬 请问怎么在指定节点下添加一条数据 #16

sfy666666 opened this issue Jul 29, 2020 · 2 comments

Comments

@sfy666666
Copy link

No description provided.

@sfy666666
Copy link
Author

sfy666666 commented Jul 29, 2020

已解决 先new一个新的Node集合 然后把node对象放进新的Node集合 然后adapter.addData(index,newArr)

                    List<Node> newArray = new ArrayList<>();
                    newArray.add(new Node(id, pid, name, bean));
                    //添加节点并刷新UI
                    mAdapter.addData(position + 1, newArray);

删除同理
先获取当前的Node对象,然后用removeData(node)

Node currentNode = TreeHelper.filterVisibleNode(adapter.getAllNodes()).get(position);
//删除一条指定的数据并刷新UI
mAdapter.removeData(currentNode);

@xiongwenzhi
Copy link

为什么我这样加入会错乱呀,可以咨询一下吗

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