问题
I have buttons in my angularjs ui-grid.But, those must be displayed only on mouseover on that particular row.I tried many things with cell template.But, not successful in doing it. Any ideas will be appreciated.
回答1:
you need to add a rowTemplate and have ng-mouseenter="grid.appScope.rowHover(row)" in the template. So is mouseleave
here is code:
$scope.gridOptions.gridOptions: {
rowTemplate: ' <div ng-repeat="col in colContainer.renderedColumns track by col.colDef.name" class="ui-grid-cell" ui-grid-cell ng-mouseenter="**grid.appScope.rowHover(row)**" ></div>',
columnDefs: [
{ field: 'status', displayName: 'Status', width: 80 },
{ field: 'to.name', displayName: 'Assignee', width: 200 }
]
}
$scope.gridOptions.appScopeProvider= {
rowHover: function(row) {
$scope.row= row.entity;
}
};
来源:https://stackoverflow.com/questions/28626553/is-there-a-way-to-display-button-in-the-angular-ui-grid-on-mouseover-on-that-par