Multi User Sync Random Duplicated Tree Nodes

I’ve been trying to use the dhtmlxTree with the dataProcessor to get multi-user syncs working. I’ve used enable_live_update() on the server side and setAutoUpdate() on the client side according to the docs. It works great.

However, I’ve noticed that sometimes the newly added nodes in the tree gets duplicated. The backend database information is fine. It’s the display that’s got a little confused. For e.g. say a tree has the following: parent A and child B, C. If I added another node (regardless of parent or child) D, I sometimes would end up with A, B, C, D, D in the tree.

I am not sure what really causes this but it’s been occurring enough to be a concern. One way to duplicate this or to see for yourself is to open up 2 same browser windows. Manipulate the tree in one, then go to the other. Hit refresh on the browser and what I mentioned should show up. I am using Firefox but the same thing happens on Safari.

Any ideas, thoughts?

I did some more testing on this and found that the duplicate only occurs when there is an “inserted” type in the actions_table.

Basically, my tree loads the full structure and when dp.setAutoUpdate() gets called and it encounters a “inserted” in the actions_table, it appends whatever was inserted into the tree but it doesn’t really seem to be correct behaviour as it doesn’t detect if that id already exists in the tree.

Can anyone help fix this or suggest workarounds?

We have not reproduced the problem in the following sample:


Is this in the “pro” version? I’ve downloaded the connector standard version but do not see this file.

I am able to reproduce this with relative ease.

I downloaded the latest stable version of dhtmlxConnector from

Since I was not able to find the “07_live_update.html” in the downloaded file -, I modified “samples/tree/05_save.html” according to this document -

Here are the modifications I did:

Added the following code at line 28. Resulting code fragment is

    var dp = new dataProcessor("05_save_connector.php");

Added the following code at line 8. Resulting code is


   $tree = new TreeConnector($res);



Steps to reproduce the duplication I was referring to

  1. Truncate the “actions_table” for good measure.
  2. Open 2 tabs in Firefox.
  3. Load “05_save.html” in both tabs.
  4. Add an item in tab1. Look at tab2
    -> Result/Observation: no live-update seen in tab 2.
  5. Refresh tab2.
    -> Result/Observation: tree gets loaded again, this time with added “item”. When 05_save_connector.php gets called (you can see this being called by enabling FF’s Tools->Web Developer->Web Console), “item” is shown again, resulting in 2 “items” instead of just 1.

Can someone try this out and let me know if it’s just me having this issue?
I am developing locally using MAMP and Firefox v10. I tried using Safari too but the same duplication happens.

Many thanks for any help rendered!

please, update file update.php in connector’s codebase from attachment. (2.24 KB)

Thanks! That seemed to have fix the problem! :slight_smile: