LazyCoder
LazyCoder

Reputation: 336

How to bind subgrid events in expandable ui-grid

ng-click event for the sub grid in ui-grid(expandable ui grid) is not working. But the same ( ng-click) is working for the outer grid with ‘grid.appScope’ scope. But I don’t know how to bind the subgrid events in expandable grid. I have kept my code in the below plnkr. ‘Click me’ is not working in the inner grid.

There is an 'expandableScope' property. But i am not sure how to use it. Plz see the for plnkr code plnkr

I have added below snippet in gridOptions

expandableRowScope: { clickMeSub: function(){alert('hi');} }

I tried to call clickMe method from expandableRowScope like below.

<button class="btn primary" ng-click="grid.expandableRowScope.clickMeSub()">Click Me </button>

Still no luck.

Upvotes: 3

Views: 2223

Answers (1)

Turneye
Turneye

Reputation: 1118

Your ng-click on the sub grid needs to just refer to it's own appscope, not the parent grids expandableRowScope.

ng-click="grid.expandableRowScope.clickMeSub()"

should be

ng-click="grid.appScope.clickMeSub()"

Modified Plunker - http://plnkr.co/edit/0o9ViW0TEuYIA4zx0kIW?p=preview

Upvotes: 1

Related Questions