I have this problem, treegrid in jqGrid ignores the last option (expanded node or not) when passing data through xml. Anyone encountered this? Is there a solution? Maybe its my data? Here is a sample data that produces the problem:
<rows>
<page>1</page>
<total>0</total>
<records>4</records>
<row id='2'>
<cell>2</cell>
<cell>Parent</cell>
<cell>0</cell>
<cell>NULL</cell>
<cell>false</cell>
<cell>true</cell>
</row>
<row id='1'>
<cell>1</cell>
<cell>Child 1</cell>
<cell>1</cell>
<cell>2</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id='3'>
<cell>3</cell>
<cell>Child 2</cell>
<cell>1</cell>
<cell>2</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id='4'>
<cell>4</cell>
<cell>Child 3</cell>
<cell>1</cell>
<cell>2</cell>
<cell>true</cell>
<cell>false</cell>
</row>
</rows>
It seems for me more as a bug in TreeGrid. Nevertheless you can easy fix the problem by adding
loaded: trueproperty to the node which need be expanded. The reason in the line of code and some above lines (see here) whereloadedproperty (andldat[loaded]) will beundefinedand so theldat[expanded]will be changed toundefinedfor all items having noloadeddefined.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:UPDATED: I think that the most easy way to fix the bug (originally described here) will be to change the line of code
setTreeNodeto the following
See the corresponding demo used the fixed code.