Showing readable data in ui-grid with editable drop-down cell

不问归期 提交于 2019-12-11 13:10:57

问题


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
            }]

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).

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" ?


回答1:


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. Replace the "value: 1" with "value: 'Read-Only'" or
  2. Change editDropdownIdLabel to 'name'

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



来源:https://stackoverflow.com/questions/28323540/showing-readable-data-in-ui-grid-with-editable-drop-down-cell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!