1

我使用 DevExtreme 模块创建了一个表并找到以下代码

<div id="data-grid">
  <div id="data-grid-table">
    <dx-data-grid id="gridContainer" keyExpr="emailId"  [dataSource]="userAccessList" [allowColumnReordering]="true" (onRowUpdated)="onRowUpdated($event)" (onRowRemoved)="onRowRemoved($event)" [showRowLines]="true" [showBorders]="true">
      <dxo-editing mode="row" refreshMode="repaint" [allowUpdating]="true" [allowDeleting]="true" [useIcons]="true"></dxo-editing>
      <dxi-column dataField="emailId" alignment="center" [allowEditing]="false" ></dxi-column>
      <dxi-column dataField="name" alignment="center" caption="name">
      </dxi-column>
      <dxi-column dataField="Designation" alignment="center" caption="Designation" [width]="100">
      </dxi-column>
    </dx-data-grid>
  </div>
</div>

上面显示正确,但是当我单击编辑图标时,对于名称字段,它显示输入字段,但我需要下拉列表。

请有人帮我解决这个问题?

提前致谢。

4

1 回答 1

1

<dxo-lookup>与要从中选择的名称列表一起使用dataSource

<dxi-column dataField="name" alignment="center" caption="name">
    <dxo-lookup [dataSource]="listOfNames"></dxo-lookup>
</dxi-column>

注意:如果你的名字是一个对象而不是一个字符串(让我们说listOfNames = [ {firstname: '', lastname: ''}, ... ]一个例子),你可以显示和使用对象的特定属性,如下所示:

<dxi-column dataField="name" alignment="center" caption="name">
    /**Uses the firstname as the value selected and as the value displayed in the dropdown list*/
    <dxo-lookup [dataSource]="listOfNames" valueExpr="firstname" displayExpr="firstname"></dxo-lookup>
</dxi-column>
于 2019-05-03T06:53:53.940 回答