angularjs – 如何在启用行选择的角度ui网格中启用文本选择

前端之家收集整理的这篇文章主要介绍了angularjs – 如何在启用行选择的角度ui网格中启用文本选择前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用ui-grid v3.1.1并启用了rowSelection.我注意到当我启用行选择时,我无法再从行中选择(单击 – 按住 – 拖动)文本.

我在他们的教程(页面上的第二个网格)中注意到example中的相同行为.

很高兴知道在启用rowSelection的同时,我仍然可以允许用户选择文本.

Here是教程中示例的插件链接.

$scope.gridOptions = { 
     enableRowSelection: true,enableRowHeaderSelection: false 
};

解决方法

A previous SO answer by @Aman Mahajan提供修复:

当enableRowSelection和enableFullRowSelection都被启用时,ui-grid-disable-selection类被添加到网格中(可以检查ui-grid v3.1.1 source in selection.js~行903).因此,您可以通过向网格添加特定类来覆盖CSS类,例如ui-grid-selectable.

<div ui-grid="gridOptions" ui-grid-selection class="grid ui-grid-selectable"></div>

在你的CSS中:

.ui-grid-selectable .ui-grid-disable-selection {
     -webkit-touch-callout: default;
     -webkit-user-select: text;
     -khtml-user-select: text;
     -moz-user-select: text;
     -ms-user-select: text;
     user-select: text;
     cursor:auto;
 }

这是the forked plunker with the added CSS class以覆盖默认行为.

猜你在找的Angularjs相关文章