views:

16

answers:

1

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.

A: 

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.

Oleg
Yeah, I've been looking at subgrid. The thing I don't like about it is that it has a whole table, with it's own column structure, whereas, with mine, the children have the same columns, so ideally they'd align. Thanks, though.
sprugman
@sprugman: It seems to me if you choose the `width` values in the `subGridModel` corresponds to the `width` values from the `colModel` of you grid you will have the results which you need. Isn't it?
Oleg
in theory, yes, but it's quite easy for those kinds of things to become out of sync. As it happens, though, the biz likes the subgrid, so we're off the hook. :)
sprugman