Folders problem - sometimes double entries

Hello DHX Team,



I use dhtmlxFolders to visualize files after selection in treegrid.The Folders get the datas from a servlet. Sometimes happens, that the entries are twice or thrice shown in the same order (e.g. f1,f2,f3,f1,f2,f3). I try to find the problem. It is difficult to test, because it happens arbitrarily. Do you know this kind of problems or can you give me some hints to contain the problem? Would a refresh-function solve the problem, because after add or delete a new file the Folders shows the correct Files. It is definitely a

display-error. The files are really only one times there.



the Init-Code:

var myFolders;



function doOnLoad(){

myFolders = new dhtmlxFolders(“folders_container”);

myFolders.setItemType(“ftable”);

myFolders.setUserData(“icons_src_dir”,"./images/");

        

myFolders.attachEvent(“onclick”,function(id){

         document.getElementById(“itemId”).value=id;

});

myFolders.attachEvent(“ondblclick”,previewImage);

myFolders.loadXML(“getFiles?refnr=” + document.documents.id.value,“codebase/types/ftable.xsl”);



}



Ajax-Request with js-function to show the different files after click in treegrid:



{…}



myFolders.clearAll();

myFolders.loadXML(“getFiles?refnr=” + document.documents.id.value,“codebase/types/ftable.xsl”);



Thanks for helping me.


Hello


such a behaviour can occur if you call the loadXML method several times (for example if you click twice on treegrid row).


To avoid this problem you can use the following approach:


var isLoaded = false;


myFolders.attachEvent(“onXLS”,function(){isLoaded = true})


myFolders.attachEvent(“onXLE”,function(){isLoaded = false})


if(!isLoaded){


myFolders.clearAll();
myFolders.loadXML(“getFiles?refnr=” + document.documents.id.value,“codebase/types/ftable.xsl”);


}