Loading grid from xml

Dear sir,



i have the Pro version of grid (v 2.0) and i am working with adobe air. The last one means that i can have access to local disk, reading and writing files.



My problem is that when I try to load grid from xml (standard procedure: mygrid.loadXML(“the.xml”)) and the XML file exists in the same folder with the .html page where the grid is in, everything works fine. But when I try to load grid from xml that exists in another folder e.g. mygrid.loadXML(“c:\documents and settings\user\desktop\another.xml”) then i get the message “Error load xml - Incorrect xml file”.



Also have in mind (if that one can help you) that i know where the xml is sitted by a javascript array. Meaning that when i write the xml file, i save the location and the name of the xml in an array. So, the code for initializing the grid is



for (var i=0;i<myprod.length;i++)

                 {

                        var thegrid=“gridbox”+i

                        mygrid=new dhtmlXGridObject(thegrid)    

                        mygrid.setImagePath(“codebase/imgs/”);

                        mygrid.enableAutoHeight(true,“400”);

                        mygrid.setSkin(“light”);

                        mygrid.init();

                        mygrid.attachEvent(“onEditCell”,checkStage);

                        mygrid.enableEditEvents(true,true,true);

                        var n=myprod[i];

                        mygrid.loadXML(n);

                      //mygrid.loadXML(“Types132.xml”);

                    }    





Could you please help me?



P.S. I have already checked if xml is well formed or not. I have opened it with ff, ie, chrome, opera and safari. All browsers can read it fine!






Problem caused by cross domain security - javascript can’t operate between documents from different domains.


More information about cause of “Incorrect XML” error you can find here dhtmlx.com/docs/products/dht … rt_comprob

Dear sir,

You just confirmed what I was thought for the cause of the problem. So, I have tried some alternative ways to load the grid data, following your documentation and samples. The problem still exists!

Case 1:  Loading data from a jsarray object

My code is:




   



       
           
       
   

               

           




I get the following error

TypeError: Null value
    at app:/codebase/grid/dhtmlxgrid.js : 896
    at app:/codebase/grid/dhtmlxgrid.js : 896
    at app:/codebase/grid/dhtmlxgrid.js : 838
    at app:/codebase/grid/dhtmlxgrid.js : 816
    at app:/codebase/grid/dhtmlxgrid.js : 784
    at app:/codebase/grid/dhtmlxgrid.js : 784
init at …


Case 2: Loading data from xml island (this is more complicated because I make the XML island on the fly)

  

   


       
           
       
   

               

           





…and I get the same error!

TypeError: Null value
    at app:/codebase/grid/dhtmlxgrid.js : 896
    at app:/codebase/grid/dhtmlxgrid.js : 896
    at app:/codebase/grid/dhtmlxgrid.js : 838
    at app:/codebase/grid/dhtmlxgrid.js : 816
    at app:/codebase/grid/dhtmlxgrid.js : 784
    at app:/codebase/grid/dhtmlxgrid.js : 784
init at …

What I am doing wrong?  Thank you in advance for any suggestion…


If you are not specifying number of grid’s columns and its width usign setHeader() and setInitWidths() you should have grid configuration into the xml sourse. It seems that your js array and xml island hasn’t grid configuration.


If you still have this issue please provide us any kind of sample including files which you are using to init grid.