-
Notifications
You must be signed in to change notification settings - Fork 84
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
Save data to database #382
Comments
You can see here our example for ASP.NET MVC: |
Ok, i use PHP and i am loading data from database and its working like a charm. What i need is when performing drag/drop to drop data through ajax and save the new order into my database. From your example i saw this:
Is there a parameter in the orgchart to be something like: chart.on ('dragdrop'......) ? Also, if not using .NET can you provide an example of how to loop all nodes to save data into arrays? like old node array and new node array? |
hi pm4698, Drag and drop is triggering the update event, so you ca use it to save your data. |
Thanks for the info. So the on update event holds 3 variables: sender, oldNode, newNode. These variables are global? Can you provide a jQuery/Javascript loop example where we loop through all nodes to get new and old Nodes? |
When you drag and drop a node, you don't need the all nodes data. You just need the newNode and you have to save the data in the function of this event.
|
So can you tell me within a line what is what? Thank you in advance |
Where is this from? |
The above event has 3 variables:sender, oldNode and newNode. What is each of this 3 variables?for a node which is the sender, which ia the oldNode and which the newNode? |
sender is the chart (OrgChart object) |
So sender is lets say object's id, oldNode is object's previous pid and newNode is object's new pid? |
No, to understand better , you can do this:
|
Thank you very much for your assistance! I used console.dir to check sender, oldNode and newNode and eventually moving object's id is newNode.id and new parent is newNode.pid. I use these 2 variables to update my database and its working like a charm! Many thanks! |
Hello there,
I started using orgchart to see how it works. I used this example/theme:
https://balkangraph.com/OrgChartJS-Demos/CustomTemplateCool.html
What i need is when someone drags/drops elements then data is automatically being saved to a database. I know how to send/save data using ajax but i don't know if there is a ready function/suggested way to loop through all nodes and get information like id and order to save it to an array and use it through ajax.
Thank you in advance
The text was updated successfully, but these errors were encountered: