Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by fcollier on Jan 29, 2008 12:49
open dhtmlx forum
XMLload is null or not an object

I am trying to use openItemsDynamic to open a path with my dhtmlxtree. We've purchased the professional version and I believe I have the correct .js files loaded. However I am getting an error that says 'XMLload is null or not an object' from Line 23 Char 702. I've imported the following script files

<script src="dhtmlxcommon.js"></script>
<script src="dhtmlxtree.js"></script>
<script src="dhtmlxtree_xw.js"></script>
<script src="dhtmlxtree_li.js"></script>

all 4 script files have a date modified of 12/14/2007.

Any ideas what's going on?
Answer posted by Support on Jan 30, 2008 03:09
Such error may occur if you entered incorrect order of items in openItemsDynamic command
Component loads nodes one-by-one from list , and if some ID from lists not exists - it will throw mentioned error.
Answer posted by fcollier on Jan 30, 2008 08:22

Actually, that was not my problem. The problem that I was having is that I was using guids for the id's. When I replaced the '-' with '_' it worked fine. Of course I had to do a bit of coding to format and reformat the guid's but it does work now. Is there a chance of getting a version that accepts '-'?

Thanks

Answer posted by Support on Jan 30, 2008 09:57
That is strange, because there is no any limitation for used chars. The default string separator is "," , so any other char inside ID must be safe enough
Can it be that problem was caused not by client side code, but by sending such uids to server? ( the - char can be escaped and not recognized by server )
Please provide a sample of uid - which not works for you correctly.
Answer posted by fcollier on Jan 30, 2008 10:29

I don't think it's from calls to the server. I load the tree dynamically through a .aspx page that returns an xml string. The following is an example of the xml

First Call
<tree id="0">
 <item text="F Upper Node" id="49c51699-76f7-4a6d-b9ce-3d7f24099a64" child="1" im0="99.gif" im1="99.gif" im2="99.gif">
  <userdata name="type">99</userdata>
 </item>
</tr>

Second Call
<tree id="49c51699-76f7-4a6d-b9ce-3d7f24099a64">
<item text="F Node" id="e182b61e-8811-4372-a871-20537c0e8702" child="1" im0="0.gif" im1="0.gif" im2="0.gif">
  <userdata name="type">0</userdata>
</item>
</tree>

Final Call
<tree id="e182b61e-8811-4372-a871-20537c0e8702">
<item text="F lower node" id="205d8635-44b3-431a-ae98-9430447a1322" child="1" im0="1.gif" im1="1.gif" im2="1.gif">
  <userdata name="type">1</userdata>
</item>
</tree>

The first call would be want was initially loaded. When F Upper Node is clicked, it calls the .aspx page with the id set to F Upper Node and returns the second call and so on. When I refresh the page, I call the javascript function that contains only the following line

tree.openItemsDynamic("49c51699-76f7-4a6d-b9ce-3d7f24099a64,e182b61e-8811-4372-a871-20537c0e8702,205d8635-44b3-431a-ae98-9430447a1322",true);

I obviously want this to be dynamic, but I hard-coded it for testing purposes. That's when it broke. Perhaps you can see something else that I am doing wrong. The true part does call a function that causes a server side post-back, but that function is being used for clicking throughout the tree as well and works fine.

Answer posted by Support on Jan 31, 2008 05:32
I recreated same sample locally ( with PHP ) - and it works correctly , without any errors in my case ( contact us at support@dhtmlx.com - if you need such working sample )
If problem still occurs for you - please try to add next code snippet at end of dhtmlxtree_xw.js , it will output debug output for each action while executing openItemsDynamic

     dhtmlXTreeObject.prototype._stepOpen=function(that){
             if(!that.ClosedElem.length){
                 that.onXLE = that.onLoadReserve;
                 if (that._opnItmsDnmcFlg)
                     that.selectItem(that.G_node,true);
                 if ((that.onXLE)&&(arguments[1])) that.onXLE.apply(that,arguments);
                 that.callEvent("onOpenDynamicEnd",[]);
                 return;
             }
    alert(that.ClosedElem.length+" elements in list");
             that.G_node=that.ClosedElem.pop();
    alert("opening"+that.G_node);
             var temp=that._globalIdStorageFind(that.G_node);
    alert("element with such id"+(temp?"":" NOT ")+" found");
             if (temp.XMLload===0)
                that.openItem(that.G_node);
             else{
                that.openItem(that.G_node);
                that._stepOpen(that);
             }
        }