this.obj.firstChild is null line 725 in dhtmlxgrid.js

Below is the source code of the form that gets this error. I’ve tried to reverse engineer this to get to the cause, but don’t yet know enough about it to be effective.

Both the data and the XMl config are below.

I am calling mygrid.init()

I need guidance please. Thank you!

Test Application
<script type="text/javascript" src="codebase/dhtmlxcommon.js"></script>
<script type="text/javascript" src="codebase/dhtmlxgrid.js"></script>
<script type="text/javascript" src="codebase/dhtmlxgridcell.js"></script>
<?xml version="1.0" encoding="UTF-8"?> Number Name Phone Unit Admit Discharge Social Security Birth Date

I removed all data and data loading and the error does not occur, so the problem must be with data loading.

Using only dynamic data JSON loading:
outGrid.load(‘ListData.a4d’, ‘json’);
…the same error occurs “this.obj.firstChild is null” and the grid does NOT display column header values.

Using only static data JSON loading (inline script data), bypassing dynamic loading, but using:
outGrid.parse(data,‘json’);
…the same error occurs “this.obj.firstChild is null” and the grid DOES display column header values.

The error seems to point to insufficient data elements for the XML defined grid.

Requesting guidance please! Thanks!!!

Try to include dhtmlxgrid_json.js file to your page. Will the issue occurs?

I included dhtmlxgrid_json.js and the same message appears, except that now I’m using the Enterprise version and the line number has changed to 848.

After including the dhtmlxcommon_debug.js I also get this message when loading the json dynamically:
“Not an XML, probably incorrect content type specified ( must be text/xml ), or some text output was started before XML data”

It seems the ‘json’ parameter passed into the ‘load’ method is not being correctly recognized.

Please help!

ServiceMinder
<script type="text/javascript" src="codebase/dhtmlxcommon.js"></script>
<script type="text/javascript" src="codebase/dhtmlxcommon_debug.js"></script>
<script type="text/javascript" src="codebase/dhtmlxgrid.js"></script>
<script type="text/javascript" src="codebase/dhtmlxgridcell.js"></script>
<script type="text/javascript" src="codebase/ext/dhtmlxgrid_filter.js"></script>
<script type="text/javascript" src="codebase/ext/dhtmlxgrid_json.js"></script>

_________ XML grid definition follows

<?xml version="1.0" ?> Number Name Phone Unit Admit Discharge Social Security Birth Date

Try to change your code like this:

function doInitGrid() { ListGrid = new dhtmlXGridObject('ListGrid'); // creates a grid instance ListGrid.setImagePath("codebase/imgs/"); // sets the path to the grid images ListGrid.setSkin("dhx_skyblue"); ListGrid.loadXML('ListGrid1.xml',function(){ ListGrid.attachHeader("#numeric_filter,#text_filter,#select_filter"); ListGrid.setSizes(); ListGrid.load('ListData1.a4d','json',function(){ ListGrid.parse(data,'json'); }); }); // defines the grid with in XML format

}

I reformed the javascript following your example, with a small change, and continue to get the error.

It seems you were suggesting in inline function declaration for the load method callback. I re-arranged the order of the load type and inline function declaration to match the expected order of parameters in the “load” method.

The error remains:
Error: this.obj.firstChild is null
Source File: 192.168.2.98/codebase/dhtmlxgrid.js
Line: 848

ServiceMinder
<script type="text/javascript" src="codebase/dhtmlxcommon.js"></script>

<script type="text/javascript" src="codebase/dhtmlxcommon_debug.js"></script>
<script type="text/javascript" src="codebase/dhtmlxgrid.js"></script>
<script type="text/javascript" src="codebase/dhtmlxgridcell.js"></script>
<script type="text/javascript" src="codebase/ext/dhtmlxgrid_filter.js"></script>
<script type="text/javascript" src="codebase/ext/dhtmlxgrid_json.js"></script>

___ data alert from dhtmlxcommon_debug.js is below:
Not an XML, probably incorrect content type specified ( must be text/xml ), or some text output was started before XML data

Loading: ListData1.a4d
Status: 200
Response: data={rows:[
{id:1,data:[‘6’,‘Elizabeth, Betty’,‘555-8741’,‘104’,‘04/08/08’,‘09/30/09’,‘123-45-7894’,‘11/12/1923’]},
{id:2,data:[‘8’,‘Beckman, Tanya’,’(888) 555-9654’,‘02’,‘12/06/08’,‘00/00/00’,‘121-21-2121’,‘01/02/1934’]},
{id:3,data:[‘9’,‘Sample, Bob’,’(333) 654-6876’,‘002’,‘08/04/09’,‘00/00/00’,’’,‘01/01/1923’]},
{id:4,data:[‘10’,‘Tracker, Thomas’,’(888) 555-4477’,‘118’,‘08/22/08’,‘08/20/09’,‘123-45-7891’,‘08/15/1925’]},
{id:5,data:[‘11’,‘Sanders, Evelyn’,’(828) 555-4747’,‘102’,‘12/01/08’,‘09/09/09’,‘324-57-8220’,‘06/01/1935’]},
{id:6,data:[‘12’,‘Peterson, Peter’,’(333) 234-5678’,‘116’,‘12/01/08’,‘09/09/09’,‘987-65-4321’,‘04/05/1910’]},
{id:7,data:[‘14’,‘Decker, Donald’,‘555-4789’,‘11’,‘01/22/10’,‘00/00/00’,‘325-64-7894’,‘02/01/1928’]},
{id:8,data:[‘15’,‘Billiam, Bill’,’(333) 329-8899’,’’,‘12/19/08’,‘00/00/00’,’’,‘03/22/1923’]},
{id:9,data:[‘16’,‘Billiam, Bill’,’(333) 329-8899’,‘13’,‘09/27/10’,‘00/00/00’,‘123-45-7894’,‘03/22/1923’]},
{id:10,data:[‘17’,‘Moore, Samantha’,’(545) 585-5555’,‘110’,‘12/12/08’,‘12/07/09’,‘35795145’,‘04/08/1917’]}
]};

____ XML grid definition follows

<?xml version="1.0" ?> Number Name Phone Unit Admit Discharge Social Security Birth Date

I think the problem may be with the response header contents expected by the .loadXML() grid definition and .load() dynamic data retrieval method.

I’ve specified Content-Type “text/xml” in the response headers for .loadXML() grid definition, and Content-Type “application/json” in the response headers for .load() dynamic json data.

Neither are working yet.

Below is the debug response when loading the grid definition document.

Not an XML, probably incorrect content type specified ( must be text/xml ), or some text output was started before XML data
Loading: ListGrid1.xml
Status: 200
Response:

<?xml version="1.0" encoding="UTF-8" ?> Number Name Phone Unit Admit Discharge Social Security Birth Date _______ ...followed by an alert: Error type: LoadXML Description: Incorrect XML _____ Below is the document source from the browser: ServiceMinder
<script type="text/javascript" src="codebase/dhtmlxcommon.js"></script>
<script type="text/javascript" src="codebase/dhtmlxcommon_debug.js"></script>
<script type="text/javascript" src="codebase/dhtmlxgrid.js"></script>
<script type="text/javascript" src="codebase/dhtmlxgridcell.js"></script>
<script type="text/javascript" src="codebase/ext/dhtmlxgrid_filter.js"></script>
<script type="text/javascript" src="codebase/ext/dhtmlxgrid_json.js"></script>
<script type="text/javascript" src="codebase/ext/dhtxmlgrid_data.js"></script>

This is still not fucking resolved? rediculous, I am still getting this shit error running grid loading xml, seem the table was not ready to append a row, what is wrong, man, fix it, will you?

You can use firebug in FF, or IE dev tools ( F12 ) in case of IE
Both tools allow to monitor XHR data loading - you can check content type of response

Also, you can try to load the same url directly in the browser - it will show more detailed error info. ( the reason why XML is not valid )