Showing readable data in ui-grid with editable dro

2019-08-13 09:37发布

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 http://ui-grid.info/docs/#/tutorial/201_editable 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条回答
Melony?
2楼-- · 2019-08-13 10:30

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.

查看更多
登录 后发表回答