Reloading Grid from XML

I have the following code that loads my grid / treegrid from an XML Dom obj that is obtained externally.  This code works fine for both tree loading and smart rendering mode. 

        if (mode == ‘tree’ || rowCount <= 15){
            // load in tree mode
            grid.parseXML(XMLContent);
        }else{
            // load it in Smart Render  mode
            var loader = new dtmlXMLLoaderObject();
            loader.xmlDoc=XMLContent;
            grid._dl_start=[[0,grid._dloadSize]];
            grid._askRealRows2(grid,loader,null,null,loader);
        }

I now have a case where I need to clear all rows and reload with a new XMLContent (which has the same structure, just different values) with out reconstructing the grid.  I tried to just use grid.clearAll(false);  and then run the above code again, but end up getting the following exception when using the tree loading (parseXML) in the dhtmlXGridObject.prototype._prepareRow function: 

    this.hdr.rows[0].cells    ‘this.hdr.rows.0.cells’ is null or not an object    Error

Is there a better way to do this? I think something like updateFromXML is what I need, but since I’m not loading via URL, this function doesn’t work for me (I think it doesn’t work in smart rendering mode either, or least I thought I read some post about this).  I need something that will update from an external XML Dom and work in both tree and smart rendering mode.

Thanks.

Hi,
I think I had another issue that was causing the problem. I just fixed it and now it appears my code above does reload the data ok. I still need to verify if it works for smart rendering mode, however.
Thanks.