Common tree manipulations like drag-n-drop (including d-n-d between trees), removing an item, inserting an item, or updating an item's label can be simultaneously reflected in the server database now (since v.1.3) using dataProcessor module.
The main features of this module are:
The data of the updated/deleted items is sent to the server to the specified URL (we call it serverProcessor).
The serverProcessor should return a simple XML or JSON of the specified format to let the tree know about successful or unsuccessful processing. All the necessary after-save procedures will be done automatically.
To enable this feature the user should do the following:
<script>
...
tree.init();
myDataProcessor = new dataProcessor(serverProcessorURL);
myDataProcessor.init(treeObj); // tree object to assign dataProcessor to, mandatory
</script>
The mandatory parameter for dataProcessor is:
Using the server-side dataProcessor the user should bear in mind the following:
<data>
<action type='insert/delete/update' sid='incoming_node_ID' tid='outgoing_node_ID'/>
</data>
In the above mentioned snippet, "incoming_node_ID" and "outgoing_node_ID" may be different for insert action only, but they are equal for other actions.
Related sample: Updating server datasource
Back to top