ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

Add tutorial for retreiving data for subgrid via $http

Open russgove opened this issue 12 years ago • 5 comments

The tutorial for subgrids has the subgrid showing data that is in the scope of the parent grid. I think a more 'real-life' scenario is to get the subgrid data using an http call.

I started looking at this and realized the subgrid shares scope with the partent grid, while I kind of thought it would have its own scopy.

Anyway, I'm looking for a pattern for showing data on a subgrid, using info retrived via http.

The sample app has the subgrid created using a template with ui-grid="row.entity.subGridOptions".

So I would assume that when the rowExpandedStateChanged event fires, I can call the $http method and stuff the returned data into row.entity.subGridOptions.data. Would that be a recommended approach?

Any examples of this anywhere?

russgove avatar Oct 29 '14 23:10 russgove

Yes, that sounds like it should work, although I think the subgrid feature is not extensively used as yet, and could still do with some work - it has some glitches in behaviour.

PaulL1 avatar Nov 04 '14 00:11 PaulL1

This was the idea behind the subgrid, to let the user fill in the template he wants when the row expands. You can even render a detail template and not a new grid if you want

novice3030 avatar Nov 07 '14 08:11 novice3030

I think this something worth exploring. A demo plunker should be possible, and if it works we can put it into a tutorial.

c0bra avatar Dec 08 '14 17:12 c0bra

If it is ok with everyone, I could add this into the 306_expandable_grid tutorial. I am doing the same thing on project I am working on.

kevin-sage avatar Dec 08 '14 17:12 kevin-sage

PR is merged, assume this is resolved, closing.

PaulL1 avatar May 27 '15 06:05 PaulL1