使用可编辑的下拉单元格在 ui-grid 中显示可读数据 [英] Showing readable data in ui-grid with editable drop-down cell

查看:26
本文介绍了使用可编辑的下拉单元格在 ui-grid 中显示可读数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可编辑的 angular-ui-grid,我在 columnDefs 对象中的可编辑列被定义为

I have a editable angular-ui-grid, where my editable column in columnDefs object is defined as

columnDefs: [ {   
                name: "rightslist",
                displayNameKey: tr.rightsList,
                editableCellTemplate: 'ui-grid/dropdownEditor',
                editDropdownOptionsArray: [{name: 'Read-Only', value: 1}, {name: 'Read-Write', value: 2}],
                editDropdownIdLabel: 'value',
                editDropdownValueLabel: 'name',           
                enableCellEdit: true
            }]

下拉菜单很好地显示了只读"和读写",但是当它关​​闭时,在网格中我看到的不是名称"而是值"(1 或 2).

The drop-down shows just fine showing me "Read-Only" and "Read-Write", but when it is closed, in the grid I see not the "name" but "value" (1 or 2).

在 ui-grid 示例 单元格的显示是使用将此类值转换为文本的文件管理器来实现的.有没有更简单的方法来告诉在未编辑单元格时显示名称,而不是值"?

In ui-grid example here display of cell is implemented using a filer that turns such value to a text. Is there any simpler way to tell "show me name, not value when cell is not being edited" ?

推荐答案

由于您不需要过滤器,我假设文本位于模型字段中.如果是这样,那么我可以想到两种解决方案.

Since you don't want a filter, I assume the text is in the model field. If that is the case then I can think of two solutions.

  1. 将value: 1"替换为value: 'Read-Only'"或
  2. 将 editDropdownIdLabel 更改为名称"

我知道 1 个有效 - 我还没有尝试过 2 个.

I know 1 works - I haven't tried 2.

这篇关于使用可编辑的下拉单元格在 ui-grid 中显示可读数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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