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

一个人想着一个人 提交于 2019-11-28 10:48:28

问题


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


回答1:


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


来源:https://stackoverflow.com/questions/6521059/in-jqgrid-treegrid-how-can-i-specify-that-i-want-the-data-collapsed-by-default

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!