xml loading error

Cant load xml data. In chrome debug console there is an error:

Uncaught TypeError: Cannot call method 'appendChild' of null

what doeas it mean ? xml data is fine.
this is my code:

<div id="w3_g1::4cb0a806b2be1" style="width: 100%; height: 150px;"></div>
<script type="text/javascript">
   var grid = new dhtmlXGridObject("w3_g1::4cb0a806b2be1");
   grid.load("/data/index/type/model/name/grid1");
</script>

Can you provide example of xml which you try to load?

<?xml version='1.0' encoding='utf-8' ?><rows><row id='1'><cell><![CDATA[tomek]]></cell><cell><![CDATA[24]]></cell></row><row id='2'><cell><![CDATA[asdasd]]></cell><cell><![CDATA[2]]></cell></row><row id='3'><cell><![CDATA[sdasd]]></cell><cell><![CDATA[212]]></cell></row></rows>

Its from connector:

 $gridConn = new GridConnector(DBManager::getConnector(), "PDO");
 $gridConn->enable_log(Logger::getLogPath()."dhtmlx.log");
 $gridConn->render_sql($sql, $model['id'], $model['columns']);

Im using attachHTMLString method on window but document.getElementById(‘id’) returns null. When i use attachObject, JS script isnt running at all.

var grid = new dhtmlXGridObject(“w3_g1::4cb0a806b2be1”);
Try to change grid container id for something without “::”. Will the issue occur?

still not working
firebug says:

this.obj.firstChild is null
[Break on this error] if (_isKHTML)this.obj.appendChild(r);...ol._dhx_insertAt(ind, r);return r;},
dhtmlx.js (row 804)

Are you setting grid configuration somewhere? You should define number of columns, it’s width, type, sorting type etc.

this is my dhxWindow initialization:

var uid = utils.generateUID();
this.windows[uid] = this.windowsManager.createWindow(uid, window.get('posX'), window.get('posY'), window.get('width'), window.get('height'));
this.windows[uid].uid = this.uid;
this.windows[uid].setText(window.get('title'));
this.windows[uid].attachHTMLString(window.get('content'));
this.windows[uid].attachEvent('onClose', this.onClose);

and this is content of window.get(‘content’):

<div>Lista osób:</div>
<div id="w3g14cb5b83c1cbd1" style="width: 100%; height: 150px;"></div>
<script type="text/javascript">
var grid = new dhtmlXGridObject("w3g14cb5b83c1cbd1");
grid.setHeader("Imię,Wiek");
grid.setInitWidthsP("*,15");
grid.attachHeader("#connector_text_filter,#connector_text_filter");
grid.load("/data/index/type/model/name/grid1");
</script>

i forgot grid.init();

Yep, grid.init(); is mandatory. Does it work now?

yes :slight_smile:
Why load methods cant invoke this automatically ?

load() method invokes init automatically only if it contains section.
Except load() method you can also use parse() method or load data from csv or json formats which cannot contain grid configuration part.