我可以设置 jqgrid 树形网格,以便它在打开的行上获取子数据吗?如何?

发布于 2024-09-27 07:49:49 字数 412 浏览 1 评论 0原文

示例树形网格实现并不十分清晰。我有一个像这样的网格:

  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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉栀 2024-10-04 07:49:49

也许 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 the subGridUrl will send. The request will contain nd_=1287002219148&id=6 as the additional parameters, where nd_ with the timestamp are used only to make every url unique and so switch local caching off.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文