您好,我正在尝试使用 jqGrid 构建 TreeGrid。一切正常,但是当我单击特定节点上的扩展时,树的大小会增加一倍。我不明白为什么会这样。
以下是截图:
点击任何节点后:
以下是我的 JQuery 代码
function showMarkingUI(rfaID){
$("#treegrid").jqGrid({
url: '<%=request.getContextPath()%>/submissions/'+rfaID+'/jqGridJson',
datatype: 'json',
mtype: 'POST',
colNames: ["ID", "File/Folder", "Valid","Marked As","Level","Parent ID","HasLeaf"],
colModel: [{
name: 'id',
index: 'id',
width: 1,
hidden: true,
key: true
}, {
name: 'file',
index: 'file',
hidden: false,
sortable: true
},{
name: 'valid',
index: 'valid',
hidden: false,
sortable: true
}, {
name: 'markedas',
index: 'markedas',
hidden: false,
sortable: true
}, {
name: 'level',
index: 'level',
hidden: true,
sortable: true
}, {
name: 'parentid',
index: 'parentid',
hidden: true,
sortable: true
}, {
name: 'hasleaf',
index: 'hasleaf',
hidden: true,
sortable: true
}],
multiselect: true,
treeGridModel: 'adjacency',
height: 'auto',
width: '500',
pager: "#ptreegrid",
treeGrid: true,
ExpandColumn: 'file',
caption: "Record Folder" ,
onSelectRow:function(id){
var ret = jQuery("#treegrid").jqGrid('getRowData',id);
if(ret.hasleaf=='false')
{
document.getElementsByName("group1")[0].disabled=true;
document.getElementsByName("group1")[1].disabled=true;
}
else
{
document.getElementsByName("group1")[0].disabled=false;
document.getElementsByName("group1")[1].disabled=false;
}
}
});
}