开发者

Can I set up a jqgrid treegrid so that it fetches the child data on row open? How?

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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜