我可以设置 jqgrid 树形网格,以便它在打开的行上获取子数据吗?如何?
示例树形网格实现并不十分清晰。我有一个像这样的网格:
ID Name Val
+ 1 Foo 45
+ 2 Bar 30
我从 json 对象填充它。当您单击 +
时,我想转到服务器并获取与该行 id 关联的数据:
ID Name Val
- 1 FooBar 45
- Foo 20
- Bar 25
+ 2 Baz 30
是否有更清楚地显示这一点的示例?另外,我看到的似乎希望您一次性获取整个数据集。或者对于这种情况,“添加”和“减去”行是更好的方法吗?
更新:进一步思考,我不认为加/减方法会很好,因为它会杀死排序。
The example treegrid implementation isn't exactly crystal clear. I've got a grid like:
ID Name Val
+ 1 Foo 45
+ 2 Bar 30
Which I'm populating from a json object. When you click on the +
, I want to go to the server and get the data associated with that row's id:
ID Name Val
- 1 FooBar 45
- Foo 20
- Bar 25
+ 2 Baz 30
Are there any examples that show that more clearly? Also, the ones I'm seeing seem to want you to fetch the whole data set in one go. Or is "adding" and "subtracting" rows a better way to go for this case?
Update: thinking a little further, I don't think the add/subtract method would be good, because it would kill sorting.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许 Subgrid 就是您所需要的?查看 demo 并选择左侧树部分的“Advanced”,然后选择“Subgrid” 。该演示使用
subGridUrl
参数和服务器 URL。例如,如果您单击 id=6 行中的“+”,则会发送对subGridUrl
的请求。该请求将包含nd_=1287002219148&id=6
作为附加参数,其中带有时间戳的nd_
仅用于使每个 URL 唯一,从而关闭本地缓存。Probably Subgrid is what you need? Look at the demo and choose "Advanced" and then "Subgrid" of the left tree part. The demo use
subGridUrl
parameter with the server url. If you click for example on "+" from the row with id=6 the request to thesubGridUrl
will send. The request will containnd_=1287002219148&id=6
as the additional parameters, wherend_
with the timestamp are used only to make every url unique and so switch local caching off.