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

查看:91
本文介绍了使用可编辑的下拉单元格在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. 将值:1"替换为值:'只读'"或
  2. 将editDropdownIdLabel更改为名称"

我知道1幅作品-我还没有尝试2幅.

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

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

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