react-ui-tree icon indicating copy to clipboard operation
react-ui-tree copied to clipboard

Only one top node?

Open icodeforyou opened this issue 10 years ago • 9 comments

Is the component limited to one top node or is this in some way configurable ?

icodeforyou avatar Sep 30 '15 12:09 icodeforyou

Yes, a root node is required for the json tree.

wangzuo avatar Oct 01 '15 01:10 wangzuo

@wangzuo Is it possible to allow not to render the root node itself?

edgesoft avatar Oct 20 '15 10:10 edgesoft

@icodeforyou @wangzuo I've implemented code to enable the root node to not be rendered. shouldRenderRootNode can be passed as prop to tree and default is true. Want a pull request for this?

This will enable the view to have the look of many rootnodes but there is still only one.

edgesoft avatar Oct 21 '15 15:10 edgesoft

@edgesoft Cool, would like to take a look at it.

But will it also be possible to make it through css only?

wangzuo avatar Oct 21 '15 15:10 wangzuo

@wangzuo But if we set visiblity to none on the rootnode we will prevent the entire tree to render. Do you have any suggestion on how to make this possible with css?

edgesoft avatar Oct 21 '15 15:10 edgesoft

@wangzuo Maybe

color: transparent;
background: transparent;

edgesoft avatar Oct 21 '15 16:10 edgesoft

I just select the first node and hide it.

.m-tree > .m-node > .inner { display: none; }

dannav avatar Oct 21 '15 19:10 dannav

@dannav @wangzuo This works great. Only need to reset the padding. Should I delete the pull request?

edgesoft avatar Oct 22 '15 08:10 edgesoft

No, i will check the pr later.

wangzuo avatar Oct 22 '15 08:10 wangzuo