I encountered a duplication bug while using enable_live_update on a tree. As I am not sure if this is a tree problem or a connector problem, I have posted a similar thread in the tree forum.
Here goes…
I am able to reproduce this with relative ease.
dhtmlxConnector_php_v10_110725
I downloaded the latest stable version of dhtmlxConnector from [url]Easy Binding of DHTMLX with Server-Side Database - dhtmlxConnector - PHP, .NET, Java, ColdFusion, ASP.NET
Since I was not able to find the “07_live_update.html” in the downloaded file - dhtmlxConnector_php_v10_110725.zip, I modified “samples/tree/05_save.html” according to this document - [url]Start DHTMLX Docs
Here are the modifications I did:
05_save.html
Added the following code at line 28. Resulting code fragment is
var dp = new dataProcessor("05_save_connector.php");
dp.init(tree);
dp.setAutoUpdate(2000);
</script>
05_save_connector.php
Added the following code at line 8. Resulting code is
<?php
require_once("../config.php");
$res=mysql_connect($mysql_server,$mysql_user,$mysql_pass);
mysql_select_db($mysql_db);
require("../../codebase/tree_connector.php");
$tree = new TreeConnector($res);
$tree->enable_live_update("actions_table");
//
$tree->render_table("tasks","taskId","taskName","","parentId");
?>
Steps to reproduce the duplication I was referring to
Truncate the “actions_table” for good measure.
Open 2 tabs in Firefox.
Load “05_save.html” in both tabs.
Add an item in tab1. Look at tab2
→ Result/Observation: no live-update seen in tab 2.
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!
Thanks for any help/suggestions/workaround!
radyno
March 14, 2012, 11:44am
#2
Hi,
please, update file update.php in connector’s codebase from attachment.
update.zip (2.24 KB)
Thanks! That seemed to have fix the problem!