有没有办法在特定行的鼠标悬停时在角度 ui-grid 中显示按钮? [英] Is there a way to display button in the angular ui-grid on mouseover on that particular row?

查看:23
本文介绍了有没有办法在特定行的鼠标悬停时在角度 ui-grid 中显示按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 angularjs ui-grid 中有按钮.但是,这些按钮必须仅在鼠标悬停在该特定行上时显示.我用单元格模板尝试了很多东西.但是,没有成功.任何想法将不胜感激.

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.

推荐答案

你需要添加一个 rowTemplate 并且在模板中有 ng-mouseenter="grid.appScope.rowHover(row)".鼠标离开也是如此

you need to add a rowTemplate and have ng-mouseenter="grid.appScope.rowHover(row)" in the template. So is mouseleave

代码如下:

    $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;      
    }

};

这篇关于有没有办法在特定行的鼠标悬停时在角度 ui-grid 中显示按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆