<ej-grid id="Grid" [dataSource]="gridData" [editSettings]="editSettings" [toolbarSettings]="toolbarSettings"> <e-columns> <e-column field="EmployeeID" [isPrimaryKey]="true"></e-column> <e-column field="FirstName" [editType]= "editType" ></e-column> <e-column field="LastName" [allowEditing]="false"></e-column> </e-columns> </ej-grid> export class GridComponent { public gridData: any; public pagesize: number; constructor() { this.gridData = window.employeeView; this.pagesize = 5; this.editType=ej.Grid.EditingType.Dropdown; this.editSettings={allowAdding:true,allowEditing:true,allowDeleting:true}; this.toolbarSettings={ showToolbar: true,toolbarItems:["add","edit","update","cancel"]}; } } |
1. The solution you provided does not allow the drop down to use a pre-defined data source.
2. Even though you could potentially use a pre-defined data source through the use of a column's "editParams" or "dataSource":
a. On edit, the drop down does not pre-select the data from the column
b. On saving an edit, the text displayed in the column is the drop down list's "value" property, not it's "text" property
Is there an easy way to do this? possibly without the use of "editTemplate"?
Thanks.
<ej-grid id="Grid" [dataSource]="gridData" [editSettings]="editSettings" [toolbarSettings]="toolbarSettings"> <e-columns> <e-column field="EmployeeID" [isPrimaryKey]="true"></e-column> <e-column field="FirstName" [editType]= "editType" [dataSource]="data1" ></e-column> <e-column field="LastName" [allowEditing]="false"></e-column> </e-columns> </ej-grid> this.data1 = [{ text: "Nancy", value: "Nancy" }, { text: "Andrew", value: "Andrew" }]; |