如何防止在 UI-GRID 中单击自定义元素上的行选择 [英] How to prevent Row selection on custom elements click in UI-GRID

查看:19
本文介绍了如何防止在 UI-GRID 中单击自定义元素上的行选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在将 UI-GRId 与行选择和自定义单元格元素结合使用时遇到问题:

I'm facing a problem in using UI-GRId with row selection and custom cell elements:

示例 plunker 在这里:http://plnkr.co/edit/Ed6s6CGFGXyUzj2cyx2g?p=预览

The sample plunker is here : http://plnkr.co/edit/Ed6s6CGFGXyUzj2cyx2g?p=preview

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

$scope.gridOptions.columnDefs = [
{ name: 'id' },
{ name: 'name'},
{ name: 'age', displayName: 'Age (not focusable)', allowCellFocus : false },
{ name: 'address.city' },
{ name:'address.pin',cellTemplate:'<select><option value="122002">122002</option><option value="122001">122001</option></select>'}];

您可以看到,在行单击时,相应的行被选中,而如果您倾向于隐式选择下拉选项,行选择事件也会被触发,我希望在元素上单击下拉菜单,行选择事件不应该被触发.

You can see that on row click, the respective row gets selected, while if you tend to select the dropdown options implicitly the row selection event also gets fired, I want that on elements click like dropdown here the row selection event should not be triggered.

请指导.

推荐答案

ui-grid 的 API 允许控制行选择.从另一个线程查看此答案:https://stackoverflow.com/a/33788459/5954939.基本上你可以使用事件rowSelectionChangedisRowSelectable.如果您需要示例,请告诉我.

ui-grid's API allows controlling row selection. Look at this answer from another thread: https://stackoverflow.com/a/33788459/5954939. Basically you can use the event rowSelectionChanged or the isRowSelectable. Let me know if you need an example.

这篇关于如何防止在 UI-GRID 中单击自定义元素上的行选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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