lobo
October 9, 2010, 5:26pm
#1
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>
Olga
October 11, 2010, 9:04am
#2
Can you provide example of xml which you try to load?
lobo
October 11, 2010, 10:29am
#3
<?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']);
lobo
October 13, 2010, 11:06am
#4
Im using attachHTMLString method on window but document.getElementById(‘id’) returns null. When i use attachObject, JS script isnt running at all.
lobo
October 13, 2010, 1:10pm
#6
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)
Olga
October 13, 2010, 1:15pm
#7
Are you setting grid configuration somewhere? You should define number of columns, it’s width, type, sorting type etc.
lobo
October 13, 2010, 1:39pm
#8
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>
Olga
October 15, 2010, 2:22pm
#10
Yep, grid.init(); is mandatory. Does it work now?
lobo
October 15, 2010, 4:48pm
#11
yes
Why load methods cant invoke this automatically ?
Olga
October 17, 2010, 7:56pm
#12
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.