TypeError: this.obj.firstChild is null

There is a error when I test. The code is:

var w1 = createWindow("*^0^0^900^430^"+title, "<html></html>");
    var toolbar = w1.attachToolbar();
    toolbar.setIconsPath("./public/images/dhtmlxToolbarImgs/");
    $.get("hotelAction!loadOperate.action?url=user/userToolbar.page.xml", function(resultJSONData) {
		toolbar.loadXMLString(resultJSONData);
	}, "html");
    authUserGrid = w1.attachGrid({
    	image_path: "/public/controls/dhtmlx/dhtmlxGrid/codebase/imgs/",
		skin: sysCfg.dhxSkin,
    });
    authUserGrid.setHeader("A,B,C,D,E,F,D,E,F");
    var data = {rows:[{id:1,data:["123121","","小区名称","123","0110","","2","---",""]},{id:2,data:["123121","","小区名称","123","0110","","2","---",""]}]}
    authUserGrid.parse(data, "json");

Please, try to call the
authUserGrid.init();
before loading data to your grid:

... authUserGrid.setHeader("A,B,C,D,E,F,D,E,F"); var data = {rows:[{id:1,data:["123121","","小区名称","123","0110","","2","---",""]},{id:2,data:["123121","","小区名称","123","0110","","2","---",""]}]} authUserGrid.init(); authUserGrid.parse(data, "json");

As you said, it works. But why the example is wrong? It wasted a lot of time.

Because you need to initialize the header of your grid before loading data to it.