in jqgrid treegrid, how can i specify that i want to load the entire tree up front versus on demand
i have an asp.net-mvc page and i am trying to use jqGrid T开发者_StackOverflow中文版reegrid. Where do you specific if you want to pass in all of the tree data upfront (versus loading on demand when you drill down). The documentation is unclear on this point
If I understand your question correct, the most important lines of the Tree Grid code to answer on your question you will find here and here. I can describe the code fragment so: if the user try to expand a node it will be examined the contain of the hidden column 'loaded'
of the node. You can post the contain of 'loaded'
column together with the JSON/XML row data. If the 'loaded'
column contains false
(or the 'loaded'
is not set by the server) the parameters nodeid
, parentid
and n_level
will be set and the tree grid will be reloaded.
So the server part from the jqGrid url
should returned the node data base on additional nodeid
, parentid
and n_level
input parameters. The server can return the "subtree" of nodes. Important is only to include the true
value in the loaded
column in the nodes which you not want to load one more time on the node expanding.
I think you do this with a combination of the adjacency model that is specified, and altering your response so it responds with ALL the data in ALL the nodes.
This page shows an example w/XML data of loading all nodes upfront.
And if this doesn't work, Oleg should be around shortly (the #1 jqGrid user on StackOverflow as of this writing). Oleg answers damn near all the jqGrid questions.
Also, see the accepted answer on this question regarding loadUI:'block'
, in case you need to use it later.
精彩评论