-
Notifications
You must be signed in to change notification settings - Fork 772
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
Saving datasource #34
Comments
I think I've got it sorted out :) |
Hi @JordiCorbilla , sorry for late response. Congratulates you on finding your own solution. If i got this demand, I think I will make the use of getHierarchy method to retrieve all the necessary data and then send them to back-end. |
Hi @JordiCorbilla . could you share your basic implementation idea for saving datasource? I guess there must be some orgchart users face the same demand. |
Hi @dabeng, Sure, I'm still working on it but I got it working. I'm loading the tree from a DB and then I'm using the getHierarchy method to get the structure. Then I parse that data and build my update sql with the ids. Quite easy and simple. I'll do the changes on my fork. Example (structure is loaded from DB and Saved to DB): Jordi |
Hello @JordiCorbilla could you please share your project details with code samples? |
Please explain how structure is loaded from DB? |
@SuperRooo please, try to do it by yourself |
Hi @SuperRooo, I think that the KnowHow will have to be done by yourself. I've got it working using the tools @dabeng provided via the OrgChart which is brilliant. So you'll have to explore how to get the data from the Db and how to save it back. To give a bit of an example, I store my tree in the DB and I configure the position of the nodes via Parent property: Id User Parent So this will be represented as: Then when building the chart, you need to send those Id as part of the structure and then when you modify the OrgChart, get the JSON the is available via getHierarchy and process it to obtain the new positions. Then send it to wherever you process this (in my case a controller as I'm using MVC for this) and the do the updates to that table so the new organisation is stored. I hope this helps. Cheers, |
Hi @JordiCorbilla can you please share the sample code how you read the datasource after making a changes to it using drag and drop. We tried to read it using GetHierarchy but the value of data-parent is not changing. |
Hi @GajendraBanctec, It is changing for me. Are you populating correctly the IDs in the structure? Because what I do later is just parsing the json structure and sending it back to my controller to save the new layout. So my code does something like that:
|
Hi JordiCorbilla, Thankyou for this implementation and it was a great help. But I am trying to modify the script so that the exported updated data types are similar to the input data types ex: like "name":"sampleNode" , "queuename":"sampleQueue" instead of "id":"1456709090909" I made all required changes but stil it do not work, can you give me some pointer? Thankyou in advance! |
Hi JordiCorbilla, I'm in the same road, but i cant parse the json from getHierarchy, i have tried with array_walk_recursive and other functions, but i lost the parent id, i can't make the relation parent->children, could you share your function to parse? Maybe i can get an idea... |
Well i come to this solution |
Hi @GeekWiinik, If you see few comments above you'll see that I'm using:
to get the tree in a string format. Then the controller has a method that consumes this string and parses it to get the details it needs.
|
Hi @JordiCorbilla ,
|
@JordiCorbilla Hi can you please share the project. Thank you! |
cannot get json data by using gethierarchy function |
please show the code |
it is possible to create using angular 5 |
谢谢 thank you ありがとうございました |
Hi there,
I'm loading my Json string with my hierarchy but after modifying the hierarchy, I want to save it so I can reopen the changes. How can I get the modified datasource from the chart?
Regards,
Jordi
The text was updated successfully, but these errors were encountered: