petko_stankoski petko_stankoski - 4 years ago 113
Javascript Question

Cannot call method 'appendChild' of null dhtmlx grid

This is my xml for the grid:

<cell>some name</cell>

I get it as via Ajax.

In the success of the Ajax call I have this:

if (data.widths != undefined) myGrid.setInitWidths(data.widths);
myGrid.loadXMLString(, function () { });

And it crashes on this line:

myGrid.loadXMLString(, function () { });

I get the error "Cannot call method 'appendChild' of null".

But everything have good values. myGrid is ok, has ok values. What seems to be the problem?

Answer Source

appendChild method is not directly related to the xml parsing, and may be caused by some grid misconfiguration, or attaching grid to non-existing html container.

When grid process loadXMLString it will try to render the column structure for first time, which in case of incorrect configuration can lead to the above error.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download