Error "this.obj.firstChild is null" while loading XML

Ok I have seen this error reported couple of times before - no working solution provided in the posts though.

So, here’s my experience with that. I have a grid attached to accordeon object (see the code below). I need to load the content from xml file (see below). When executing load method the content is not loaded and the message “Error: this.obj.firstChild is null” pointing to “codebase/dhtmlx.js Line: 805” is displayed via Error console of Firefox.

I have tried doing the same exercise with loading csv file - with exactly the same result :frowning:

Here’s my index.html piece

[code]

grid test
<!-- dhtmlx.js contains all necessary dhtmlx library javascript code -->
<script type="text/javascript" src="../codebase/dhtmlx.js"></script>
<!-- dhtmlx.css contains styles definitions for all use components -->
<link rel="stylesheet" type="text/css" href="../codebase/dhtmlx.css">
<script src="../codebase/connector/connector.js"></script>

<style>
    /*these styles allow dhtmlxLayout to work in fullscreen mode in different browsers correctly*/
    html, body {
       width: 100%;
       height: 100%;
       margin: 0px;
       overflow: hidden;
       background-color:white;
    }
</style>

<script type="text/javascript">
	dhtmlx.image_path = "../codebase/imgs/";

	var layout;
	var dhxAcc;
	var accGrid;
	var mainLayout;

	dhtmlxEvent(window,"load",function(){
		//layout
		mainLayout = new dhtmlXLayoutObject(document.body,"2E");
		mainLayout.cells("a").setHeight("50");
		mainLayout.cells("a").setText("");
		mainLayout.cells("a").hideHeader();
		mainLayout.cells("b").setText("");
		mainLayout.cells("b").hideHeader();
		mainLayout.cells("a").fixSize(true,true);
		
		layout = mainLayout.cells("b").attachLayout("2U");
		layout.cells("a").setWidth(200);
		layout.cells("a").setText("");
		layout.cells("b").setText("");
		layout.cells("b").fixSize(true,false);
		
		//left
		dhxAcc = layout.cells("a").attachAccordion();
		dhxAcc.setIconsPath("../icons/");
		dhxAcc.setSizes();

		dhxAcc.addItem("1", "Test");
		dhxAcc.cells("1").setIcon("test_icon.png");
		dhxAcc.cells("1").setHeight("180");
		accGrid = dhxAcc.cells("1").attachGrid();
		accGrid.setInitWidths("156,156");
		accGrid.setNoHeader(true);
		accGrid.enableRowsHover(true,"hover");
		accGrid.setColAlign("center,center");
		accGrid.setColTypes("ro,ro");
		accGrid.setEditable(false);
		accGrid.init();			
		accGrid.load("../engine/employees.xml");
	});
</script>
[/code]

and this is the xml (no white spaces before <?xml :wink: )

<?xml version='1.0' encoding='iso-8859-1'?> <rows> <row id="a"> <cell>Test 1</cell> <cell>Test 2</cell> </row> <row id="b"> <cell>Test 3</cell> <cell>Test 4</cell> </row> </rows>

If I remove the accGrid.load() method calling - no error occurs of course. No data is loaded into the grid then though.

Any clue on what is the cause? Am I doing something wrong here? Any alternatives of laoding data from different sources?

Despite that you don’t need header in your grid, it should be defined anyway.
PLease, try to add grid.setHeader(“1,2”) before grid.setNoHeader() method