Reputation: 4811
I have enabled ui-grid-selection
on grid.As a result that when row is selected it will be get highlighted but my requirement is that i want to highlight the row only when the cell template button is clicked.Please let me know how to do this.
Upvotes: 0
Views: 549
Reputation: 4811
Finally was able to find a way to do that.Here is the answer.
What i did was,
enableRowSelection: false
.Button Cell Template
<div><button class="btn btn-default" ng-click="grid.appScope.selectRow(row)">O</button></div>
Implement a function to select given row obj.
$scope.selectRow = function(row) {
row.setSelected(true);
};
if you want to unselect the selected row when the template button is clicked again you can use row.isSelected
this will return boolean value.Here is the updated function code snippet.
$scope.selectRow = function(row) {
if(row.isSelected!=true){
//Select the row
row.setSelected(true)
}else{
row.setSelected(false)
}
};
Upvotes: 1