Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...