jqgrid - 用于平面结构数据的树形网格
我将数据以扁平结构存储在数据库中,没有任何层次结构,并且当前使用 jqgrid 以表格格式显示。我想以向下钻取的方式显示它,例如顶层的计数,子级别的嵌套方式。可以使用jqgrid吗...
I have my data stored in database in flat structure with out any heirarchical fashion and currently displaying in tabular format using jqgrid. I would like to display it in drill down fashion like the count at the top levels, child levels like this in nested fashion. Is it possible to do using jqgrid...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为进行某些查询的最佳方法是在服务器端使用 GROUP BY 来构建有关数据层次结构的信息。您将以此方式构建所需的树结构。主要数据将获取
isLeaf:true, level:4, Expanded:false, returned:true
属性和父节点 id 为“2200”的parent
属性。如果您使用带有前缀的值作为 id,例如“e”代表“Event”,“m”代表“Model”等等,您将可以轻松地为每一行构建唯一的 id,这样您就能够构建该行的所有数据。服务器上的树形网格,然后将数据放入服务器响应中。或者,您可以仅填充树网格的顶层。您可以构造简单的查询来生成结果集。如果用户打开某个树节点,新请求将被发送到服务器。该请求将包含一些其他参数:
nodeid
、parentid
和n_level
。如果您选择了根项上的 id 值,您将拥有构建查询的完整信息,这将使您进入树的下一个级别。您应该使用parentid
来构造查询的WHERE
部分。通过这种方式,您还可以构建树并按需加载所有节点。I think that the best way to make some queries used GROUP BY on the server side to construct the information about the hierarchy of the data. In the way you will be construct the tree structures which you need. The main data will get
isLeaf:true, level:4, expanded:false, loaded:true
properties andparent
property with the id of the parent node "2200". If you would use as ids the values with prefixes like 'e' for 'Event', 'm' for 'Model' and so on you will be easy construct unique ids for every row so you will be able to construct all data for the Tree Grid on the server and then place the data in the server response.Alternatively you can fill only the top level of the tree grid. You can construct simply query which will produce the resulting set. If the user will opens some tree node the new request will be sent to the server. The request will contains the some additional parameters:
nodeid
,parentid
andn_level
. If you good choose the id values of on the root items you will have full information to construct query which will get you the next level on the tree. You should useparentid
as to construct theWHERE
part of the query. In the way you can also construct the tree and load all noded on-demand.