How to highlight current row when clicking cell template button in angular ui interface
1 answer
Finally was able to find a way to do it. Here's the answer .
What I've done,
- The mesh option is changed
enableRowSelection: false
. - Add function to cell template button.
Button cell template
<div><button class="btn btn-default" ng-click="grid.appScope.selectRow(row)">O</button></div>
-
Implement a function to select the given string obj.
$scope.selectRow = function(row) { row.setSelected(true); };
if you want to deselect the selected row when the template button is pressed again, you can use row.isSelected
this will return a boolean. Here is an updated snippet of the function code.
$scope.selectRow = function(row) {
if(row.isSelected!=true){
//Select the row
row.setSelected(true)
}else{
row.setSelected(false)
}
};
+1
source to share