Categories | Question details Back To List | ||
Double entries after Drag and Drop Hi, I have got problem with the dhtmlxTree. I have enabled autoloading and drag and drop. If a user moves a node from one folder to another the new one should be refreshed. In Internet Explorer it is working fine but in Firefox I am getting double entries for the node and after reloading the complete page everything is in right order. I tried to use refreshItem() but it does not work for Firefox. What can I do to prevent double entries after Drag and Drop? Answer posted on Oct 09, 2007 13:13 >>I am getting double entries The issue can be caused by request concurency [1] - d-n-d occurs [2] - server side request done to insert new record in DB [3] - XML with child items fetched if [2] finished before [3] started , fetched XML will contain newly added item, which already exist in view after d-n-d, so in result two items will be in tree. >>I tried to use refreshItem() but it does not work for Firefox. Problem is not reconstructable with local samples. Which version of dhtmlxTree do you use? Can you please provide any kind of sample ( just js code will be enough ) where you using refreshItem. ( if it used from onDrag event - it will not work as expected for sure, but from onDrop event it must work ) Answer posted by Chris on Oct 09, 2007 19:31 Thanks for the reply. Here is a code sample I use for refreshing items var selectedId = tree.getParentId(tree.getSelectedItemId()); var url = //URL with parameters var XMLHttpRequestObject = false; if (window.XMLHttpRequest) { XMLHttpRequestObject = new XMLHttpRequest(); } else if (window.ActiveXObject) //IE { XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP"); } XMLHttpRequestObject.open("GET",url,false); XMLHttpRequestObject.send(null); if(navigator.appName=="Microsoft Internet Explorer") { tree.refreshItem(selectedId); } else { tree.deleteChildItems(selectedId); tree.loadXML("./feed_tree.php?id="+selectedId); } This works now for FF and IE. For Double Entry Issue: It also occurs in Internet Explorer too, if Folder is Closed and Drag and Drop fails on Internet Explorer if move node is the last one in a folder Thanks |