React-sortable-tree: How to use getTreeFromFlatData method. ---Not an issue. Just a Doubt

Created on 21 Aug 2017  路  7Comments  路  Source: frontend-collective/react-sortable-tree

Hi,
Thank you for this Component.It is very usefull.

I have a json data in the format as below

"Data": [{
"id": 2,
"name": "Parent1",
"acronym": null,
"parentId": null,
"child": [{
"id": 4,
"name": "child1",
"acronym": "ABC",
"parentId": 2,
"leaf": [{
"id": 2,
"acronym": "ALLUUI",
"name": "leafNode1"
},
{
"id": 4,
"acronym": "LGGM",
"name": "LeafNode2"

        }
    ]

}]

,{......},{....}
]

How can i use the getTreeFromFlatData method to get the object structure required for treeData?

Most helpful comment

I added a new example to the storybook, called treeData import/export demonstrating how to use the getTreeFromFlatData function. The source is available too. Does that help answer your question?

@fritz-c
Does this example still available at any place?
It returns 404 馃槙

All 7 comments

I added a new example to the storybook, called treeData import/export demonstrating how to use the getTreeFromFlatData function. The source is available too. Does that help answer your question?

Hi fritz-c,
Thanks for the effort, I have a question concerning "treeData". In my case I am using meteor and getting data for the "Tree" react component from createContainer which returns the data from a reactive data source so how am I supposed to update "treeData" if its initialized in the constructor and the constructor only gets called once. If you think its totally different subject I could open another issue if you don't mind.

thanks. It was helpfull.

@kemo71 i suggest you to pass your props with componentWillReceiveProps(newProps) not with (createContainer) and in this method you can init your state with the new (treeData) passed from the other components ..
in every update you get for the new treeData (from the props) , it will update your state and you can always render your [treeData] from the state (because its reactive) ..

@fritz-c is your example still available somewhere ? Link does not seem to work anymore

I added a new example to the storybook, called treeData import/export demonstrating how to use the getTreeFromFlatData function. The source is available too. Does that help answer your question?

@fritz-c
Does this example still available at any place?
It returns 404 馃槙

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NickEmpetvee picture NickEmpetvee  路  3Comments

Suremotoo picture Suremotoo  路  4Comments

jorgecuesta picture jorgecuesta  路  4Comments

LogicMonsters picture LogicMonsters  路  5Comments

brendanmoore picture brendanmoore  路  5Comments