Jquery树形网格(jqgrid)子项的xml结构
谁能告诉我 jqgrid 使用的子项目的 XML 结构。 我已阅读文档,但它没有清楚地解释如何创建包含子项的树视图。 基本上我有一个 2 列网格,3 个级别。
Can anyone please tell me the XML structure for sub-items that jqgrid uses. I've read the documentation and it does not explain clearly how one would create a tree view with sub-items in it. Basically I have a 2 column grid with 3 levels.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自演示:
http://www.trirand.com/jqgrid35/jqgrid.html
(根据新在版本 3.3-> 树网格中)
它使这个 ajax 调用作为一个帖子:
http://www.trirand.com/jqgrid35/server.php?q=树
post参数看起来像:
它返回的正是这样的:
对于每个子行,它都会进行另一个ajax调用。 第一个“单元格”元素指定行号。 当下一行 id 之前有一个间隙时,它知道它有子项,并将为该行放置一个扩展器。 当用户选择扩展器时,它会进行另一个 ajax 调用,并返回以下内容:
查看源代码,它指定列名称,并期望它们按顺序返回。 我很确定您可以编写此代码而不期望特定的顺序,但这就是映射的设置方式。 这几乎是 ext 做事方式的克隆,这是一个很好的遵循方式,因为他们做得很好。
并且,为了完整起见,让我们包括 PHP 源示例(经历了这么多麻烦,不妨结束它!):
From the demo:
http://www.trirand.com/jqgrid35/jqgrid.html
(under new in version 3.3->tree grid)
It makes this ajax call as a post:
http://www.trirand.com/jqgrid35/server.php?q=tree
The post parameters looks like:
Which returns exactly this:
For each sub row it makes another ajax call. The first "cell" element specifie the row number. When there is a gap before the next row id, it knows that it has subitems, and will put an expander for that row. When the user selects the expander, it makes another ajax call, and the following is returned:
Looking at the source, it specifies column names, and it's expecting them to be returned in order. I'm pretty sure you can write this to not expect a particular order, but that's how the mapping is set. This is pretty much a clone of the way ext does things, which is a good way to follow because they do it well.
And, for completeness, lets include the PHP source example (went through this much trouble, might as well finish it off!):