Tal Tal - 1 month ago 41
jQuery Question

Free jqGrid TreeGrid - Unload Data

As part of the next Project, I'm looking for a solution that will let me support an on-demand load of the tree hierarchy.

I know jqGrid support that.

My problem is this: Since I need to support also a size of 3-10 millions of hierarchy branches, I wonder if there is a way to unload branches that are not in use anymore. For example, if I open root-a-b-c, and I now go and open root-a-d-f, I would want to be able to release branches b-c from memory.

Can this be done in jqGrid?

Thanks,

Tal.

Answer

You can use afterCollapseNode callback, which will be called after the node will be collapsed. Inside of the callback you can use getNodeDepth method to get all children node (leafs and sub-nodes recursively) and then remove the elements from the grid. Finally one should set loaded property of the collapsed node to false. I think the result will be what you want to implement. I'll consider to implement such behavior in TreeGrid in the future (by introducing a new option).