It seems for me more as a bug in TreeGrid. Nevertheless you can easy fix the problem by adding loaded: true
property to the node which need be expanded. The reason in the line of code and some above lines (see here) where loaded
property (and ldat[loaded]
) will be undefined
and so the ldat[expanded]
will be changed to undefined
for all items having no loaded
defined.
The demo demonstrate the solution. It uses XML which you posted but with additional <cell>true</cell>
added at the end of definition of "Parent"
item:
...
<row id='2'>
<cell>2</cell>
<cell>Parent</cell>
<cell>0</cell>
<cell>NULL</cell>
<cell>false</cell>
<cell>true</cell>
<cell>true</cell> <!-- added the element for loaded: true -->
</row>
...
UPDATED: I think that the most easy way to fix the bug (originally described here) will be to change the line of code setTreeNode
ldat[expanded] = ((ldat[expanded] == "true" || ldat[expanded] === true) ? true : false) &&
ldat[loaded];
to the following
ldat[expanded] = ((ldat[expanded] == "true" || ldat[expanded] === true) ? true : false) &&
(ldat[loaded] || ldat[loaded] === undefined);
See the corresponding demo used the fixed code.