AngularJS ng-grid with custom button

Sudarshan picture Sudarshan · Mar 26, 2013 · Viewed 18.9k times · Source

I am using angular button in a ng-grid. I need to know how can i identity which button was clicked from within the grid.

I guess part of the complexity is that the button is clicked before the row is selected (Just my analysis,probably wont help with the solution :)

A snap shot of how the grid looks

ng-grid

A plunker illustrating the problem here

Answer

Sudarshan picture Sudarshan · Mar 26, 2013

I have been able to find out how to resolve my question,basically pass in "row" as an argument on your function for ng-click. ng-click="save(row)"

Before

.. ng-click="edit(selectedItem)" >Edit</button> '

After

.. ng-click="edit(row)" >Edit</button> '

I have updated the plunker here to reflect the same

row.entity will give me the entity bound to this row of the grid