1

I have a requirement to show a set of hierarchical data in a single column in the ng-grid with '+' to expand/collapse parent row.

I've looked at its grouping function, but doesn't seem to do the job for me.

My data would be like follows:

{
     {name: 'Parent 1', children: {}},
     {name: 'Parent 2', children: {{name: 'Child 1'}, {name: 'Child 2'}, {name: 'Child 3'}}},
     {name: 'Parent 3', children: {}},
}

I want it to display in the grid as follows, in the same column:

Parent 1
Parent 2
   Child 1
   Child 2
   Child 3
Parent 3

What is the best way to achieve this with ng-Grid? Should I use an alternative json object for this?

Thanks in advance

devC
  • 1,384
  • 5
  • 32
  • 56

1 Answers1

2

See this related question and a plunker I wrote that does this kind of thing: http://plnkr.co/edit/fOMMXePQhWAF4DOnF3dW?p=preview

angularjs ng-grid: parent child relations between the rows (hide/show rows)

Community
  • 1
  • 1
lmyers
  • 2,654
  • 1
  • 24
  • 22