我已使用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>
以上显示正确,但是当我单击编辑图标时,名称字段显示输入字段,但我需要下拉列表。
请有人帮我解决吗?
谢谢。
答案 0 :(得分:0)
在名称列表中使用<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>