Reputation: 5954
I'm using jqGrid Tree grid for displaying some hierarchical data. I've to implement the delete functionality and so far so good its done, only thing that is causing a problem "is that when all the children of a specific node is are deleted then this node should become a leaf node i.e. its icon should be changed from arrow to leaf one"
I'm using following code to delete the node from the grid
$trackerGrid.jqGrid('delTreeNode', actoinItemEntityId);
var record = getRowRecord(baseId);
var siblingArray = $trackerGrid.jqGrid('getNodeChildren', record);
if(!siblingArray || !siblingArray.length) {
$trackerGrid.jqGrid('collapseNode', record);
setLeafColumnValue(baseId, false);
}
the nodes gets deleted successfully but the icon of parent does not change and the icon remains that of expanded node. Anybody got any idea about this?
Upvotes: 0
Views: 859
Reputation: 221997
In common case a Node without children in the TreeGrid is not the same a Leaf. You can imagine node as folder and leaf as file. Even if you delete all files from the folder it will be stay folder and will be not converted to file.
If in your use case the behavior which you describe have sense I would recommend you to do following:
getLocalRow
to get local data
by rowid;addChildNode
with the same data as before, but with isLeaf: true
.In the case you will have code which hold all standards of TreeGrid and it will work in next versions of jqGrid.
Upvotes: 1