Currently, I am working with ng-grid and am attempting to define a callback function for when a cell is clicked. During this callback, it is crucial for me to identify the specific row and column of the cell that was clicked. Upon exploring various options, I decided that embedding an onclick event within the cellTemplate in columnDefs for each column seemed to be the most effective approach, despite the redundancy it introduced:
$scope.gridOptions = {
data: 'myData',
columnDefs: [{field: 'name', displayName: 'Name',
cellTemplate: '<div onclick="...">{{row.entity[col.field]}}</div>'
},
{field: 'age', displayName: 'Age', cellTemplate: ...}
]
};
However, I encountered challenges with this method as ng-click was ineffective, and integrating the controller's scope with onclick proved to be unviable.
Any alternative solutions that do not rely on ng-grid are also greatly appreciated.