in jqgrid treegrid, how can i specify that i want the data collapsed by default (even though all data is loaded)
Asked Answered
P

1

1

I am loading a full treegrid but i would like to have it collapse to only show level 1 (versus showing everything expanded)

is there anyway to specify initial view (collapsed or expanded) when my jqgrid treegrid loads and reloads

again, i DO want to load everything to the client, but just show things collapsed as the inital view.

i don't see any option on the main documentation page

Prussian answered 29/6, 2011 at 13:2 Comment(0)
T
2

You don't included in the question neither jqGrid definition nor the test JSON or XML data which you use to fill the three grid. I suppose, that you filled the 'expanded' column of the tree grid with true. The hidden column 'expanded' exist in the tree grid for both mode Nested Set Model and Adjacency Model. If you would set false in the column the tree will be not expended. See here an example.

You should take a look in the next-to-last column of the AdjacencyTree.json. It contains false, so no tree node will be expanded. The contain of the hidden columns from the JSON file are the following

level parent isLeaf expanded loaded
-----------------------------------
  0          false    false   true
  1     1    false    false   true
  2     2     true    false   true
  2     2    false    false   true
  3     4     true    false   true
  2     2     true    false   true
  1     1    false    false   true
  2     7    false    false   true
  3     8     true    false   true
  3     8     true    false   true
  2     7     true    false   true
Testerman answered 29/6, 2011 at 22:0 Comment(3)
makes sense . . i thought i had that set to false but it was true . .Prussian
I have expanded:true and loaded:true, the data loads and displays okay but i am not able to see the collapse action, as by default all the rows have been expanded. Any help?Resorcinol
@Shah: You should better open new question and include in the question the JavaScript code which you use and the JSON data, so one could reproduce your problem.Testerman

© 2022 - 2024 — McMap. All rights reserved.