Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Mar 09, 2009 13:40
open dhtmlx forum
Folders Context type

Alex, Thank you for your reply. Your answer stated to check Context type. I was pretty certain that it is correct. I'm using the example Image Browser.

    <script>
        var myFolders;
        function doOnLoad(){
            myFolders = new dhtmlxFolders("folders_container");
            myFolders.setImagePath("../../../codebase/imgs/");
            myFolders.setItemType("fthumbs");
            //set values to be used in xsl templates
            myFolders.setUserData("icons_src_dir","./images/");
            myFolders.setUserData("thumbs_creator_url","./thumbs_creator.php");
            myFolders.setUserData("photos_rel_dir","./photos/");
            //load data
            myFolders.loadXML("photos/getPhotos.php","../../../codebase/types/fthumbs.xsl");
            myFolders.attachEvent("onclick",function(id){
                var imgObj = document.getElementById("previewimage");
                var dataObj = this.getItem(id).data.dataObj;
                var fileName = dataObj.getAttribute("name");
                var fileSize = dataObj.getElementsByTagName("filesize")[0].firstChild.nodeValue;
                var imgSrcFull = "photos/"+fileName;
                imgObj.src = imgSrcFull;
                imgObj.style.display = "";
                //populate file info block
                document.getElementById("img_name").innerHTML = fileName
                document.getElementById("img_size").innerHTML = fileSize+"b";
            });
        }

        function loadType(elem,tName){
            //chnage type
            myFolders.setItemType(tName,"../../../codebase/types/"+tName+".xsl");
            //change style
            if(elem.id!="selectedbutton")
                document.getElementById("selectedbutton").id = "";
            elem.id = "selectedbutton";

        }


    </script>

thx alex
Answer posted by Alex (support) on Mar 10, 2009 04:20

Hello,

In case of using the sample from the package the possible reasons are:

1) server returns xml with incorrect content type;

2) you load the sample page from the local file system (it is necessary to load by http://)