TreeGrid was originally implemented so that it contained all the additional information about the tree structure in hidden jqGrid columns. Later jqGrid starts supporting local data, but hidden columns still exist on every row.
In older versions of TreeGrid, only data from the server can be downloaded. At the beginning, jqGrid should load only the root nodes (nodes, the parent is null ). If you need to deploy node, a new Ajax request with additional parameters nodeid , parentid and n_level (or nodeid , n_left , n_right , n_level if treeGridModel: "nested" ) will be sent to url . The server should return data based on the parameters. Once the data has been loaded and the node needs to be collapsed, the children will be hidden using the display: none CSS style. The next time jqGrid should not download data from the server again. Instead, jqGrid just shows the children of the node. Exactly if the loaded column (hidden column) of the parent node contains true .
In the case of creating a TreeGrid with local data, everything works exactly as described above. Sorry, TreeGrid still does not support datatype: "local" , but you can use almost the same when using datatype: "jsonstring" . My old answer , which you indicated in your question, demonstrates the approach. Since the jqGrid (TreeGrid) structure is still oriented toward remote loading, you just need to set the loaded:true property to all data nodes. As a result, the remote TreeGrid works without additional communication with the server. All data will be loaded immediately, but the minimized node fill follows the hidden children.
Thus, we can say that using the loaded:true property is a hack, which allows you to simultaneously load all TreeGrid data and slow down the expansion or failure of nodes without additional communication with the server.
Oleg
source share