1

i have an asp.net-mvc page and i am trying to use jqGrid Treegrid. 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

Oleg
  • 220,925
  • 34
  • 403
  • 798
leora
  • 188,729
  • 360
  • 878
  • 1,366

2 Answers2

2

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.

Oleg
  • 220,925
  • 34
  • 403
  • 798
  • my issue is that i am passing in all of my data as json but when i click on the drill down it seems to go back to the server and it duplicates the rows. I don't want it to go back to the server on drilldown – leora Jun 28 '11 at 17:05
  • @ooo: You should place 'true' values for the 'loaded' column and your problem will be solved. In [the demo](http://www.ok-soft-gmbh.com/jqGrid/AdjacencyTreeWithHTML.htm) which I posted you in [the answer](http://stackoverflow.com/questions/6507186/is-it-possible-to-have-html-inside-of-a-jqgrid-treegrid-cell/6509041#6509041) the problem is not exist. If my explanation will not help you you should include the grid definition and the row of JSON data returned from the server. I could see what it you problem and where you should place the `true` value for the `'loaded'` column. – Oleg Jun 28 '11 at 17:18
  • thanks Oleg, that did the trick . . the documentation for the columns are a little unclear – leora Jun 28 '11 at 17:30
  • the treegrid seems really slow in internet explorer . . i have 2 levels of heirarchy and about 400 rows – leora Jun 28 '11 at 18:27
0

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.

Community
  • 1
  • 1
jefflunt
  • 33,527
  • 7
  • 88
  • 126
  • thanks for your response. I had another bug that was hiding the fact of why it wasn't working. We should make the tag jqgrid and Oleg synonyms – leora Jun 28 '11 at 16:16
  • & @ooo: Thanks for good words about my work on the stackoverflow! I wrote my answer, which describes how I understand the problem from the question. – Oleg Jun 28 '11 at 16:51
  • @Oleg - I just want one of my jqGrid answers to be accepted over yours ... some day. :) – jefflunt Jun 28 '11 at 18:29
  • Sorry, I will try to write the answer not so quickly. Only if the problem will be not solved by other I will write my answer. I would like to see more answers from other people about the jqGrid. I have enough reputation points which I never could use. :-) – Oleg Jun 28 '11 at 18:45
  • Oh, don't do that. That's like "letting me win". I want to earn it. – jefflunt Jun 28 '11 at 18:58