BALKANGraph / FamilyTreeJS

Build family tree app with BALKAN FamilyTreeJS library. Family Tree also called a genealogy or a pedigree chart, is a chart representing family relationships in a conventional tree structure.
50 stars 16 forks source link

Question : How to save Family Tree in database ? #82

Closed dahut07 closed 6 months ago

dahut07 commented 8 months ago

Hello,

In the documentation i didn't found an example of saving the Tree in database (SQLite for eg). How to proceed ?

Maybe this way but it is not elegant : 1) Intercept the "onUpdateNode" event 2) Export the tree in CSV let csv = OrgChart.convertNodesToCsv(family.config.nodes); 3) Save CSV in database with my backend code

And Import CSV from database when i want to open my project?

 StringBuilder sb = new StringBuilder();
 using (var p = ChoCSVReader.LoadText(myJsonFromDb)
     .WithFirstLineHeader()
     )
 {
     using (var w = new ChoJSONWriter(sb))
         w.Write(p);
 }

What is the best way to do this?

Thanks.

ZornitsaPesheva commented 8 months ago

Here we have server side examples: https://balkan.app/FamilyTreeJS/Docs/GitHub