Common TreeView manipulations like drag-n-drop, removing an item, adding a new item or updating an item's label can be simultaneously reflected in the server database using DataProcessor.
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 TreeView 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:
myTreeView = new dhtmlXTreeView("treeviewObj");
...
var dp = new dataProcessor("data.php");
dp.init(myTreeView); // treeview object to assign DataProcessor to, mandatory
dp.setTransactionMode("REST");
Using the server-side DataProcessor the user should bear in mind the following:
The response can be any valid JSON object.
The full server response should contain the following properties:
There are 5 predefined types of response:
So, an example of response can be as follows:
{"action":"updated","sid":"2","tid":"2"}
To change the id of the event while updating, use the tid property.
{"tid":"some"}
Back to top