Allow custom required properties for id, parent, text etc
elmcapp opened this issue · 0 comments
elmcapp commented
I would be nice if we could select our own property names for the required properties.
Reason. I get my data from a api and instead of needing to map the data to match what the tree view require it would be nice if I can just use the data
Here are the required fields:
[
{
"id": 1,
"parent": 0,
"droppable": true,
"text": "Folder 1"
},
I would like the options to make id called UUID, I would like the option to have text called label. Check out example below
<Tree
parentName={"parent"}
text={"lable"}
id={"UUID"}
tree={treeData}
rootId={0}
onDrop={handleDrop}
render={(node, { depth, isOpen, onToggle }) => (
<div style={{ marginLeft: depth * 10 }}>
{node.droppable && (
<span onClick={onToggle}>{isOpen ? "[-]" : "[+]"}</span>
)}
{node.text}
</div>
)}
/>;