I am having a problem with an autoloading tree grid.
At present I have a structure that is only 2 levels deep.
1
a
b
c
2
a
When I click to expand a node, the grid seems to add another instance of the root node again as well as whichever sub node(s) should have been shown based on the the root node selected.
1
1
a
b
c
Here is a look at the XML before selecting the root node:
<?xml version="1.0" encoding="UTF-8"?>
<rows>
<page>1</page>
<total>1</total>
<records>1</records>
<row>
<cell>1112</cell>
<cell>Parent 1</cell>
<cell>0</cell>
<cell>NULL</cell>
<cell>false</cell>
<cell>false</cell>
</row>
</rows>
And here is a look at the XML after selecting the root node:
<?xml version="1.0" encoding="UTF-8"?>
<rows>
<page>1</page>
<total>1</total>
<records>1</records>
<row>
<cell>1112</cell>
<cell>Parent 1</cell>
<cell>0</cell>
<cell>NULL</cell>
<cell>false</cell>
<cell>false</cell>
</row>
<row>
<cell>5207</cell>
<cell>Child 1</cell>
<cell>1</cell>
<cell>1112</cell>
<cell>false</cell>
<cell>false</cell>
</row>
</rows>
Also, here is my config:
$(document).ready(function(){
$("#gReport").jqGrid({
treeGrid: true,
treeGridModel: 'adjacency',
ExpandColumn: 'company',
url: document.forms['frmReport'].elements['gaddr'].value,
datatype: 'xml',
mtype: 'GET',
colNames: ["ID", "Company"],
colModel: [
{name: 'id', index: 'id', width: 1, hidden: true, key: true},
{name: 'company', index: 'company', width: 40, hidden: false, sortable: true}
],
rowNum: -1,
width: 980,
height: 'auto',
pager: false,
caption: ''
}),
});
Any help would be greatly appreciated.
Thanks.
-chris
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…