|
@Component({
selector: 'app-container',
templateUrl: 'app.component.html'
})
export class AppComponent implements OnInit {
public data: Object[];
public country: string[] = ['France', 'Germany', 'Brazil', 'Belgium', 'Switzerland',
'USA', 'Austria', 'Mexico', 'Austria', 'Venezuela'];
@ViewChild('grid')
public grid: GridComponent;
ngOnInit(): void {
this.data = data;
}
queryCellInfo(args: any) {
if (args.column.field === 'ShipCountry') {
const targEle1: HTMLInputElement = args.cell.querySelector('.e-cmb');
targEle1.id = 'e-cmb' + args.data[this.grid.getPrimaryKeyFieldNames()[0]];
const comboBoxObj: ComboBox = new ComboBox({
dataSource: this.country,
value: 'France',
placeholder: 'Select a country});
comboBoxObj.appendTo(targEle1);
}
}
} |
|
<div class="control-section">
<ejs-grid #grid [dataSource]='data' allowPaging='true' (queryCellInfo)='queryCellInfo($event)'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right' [isPrimaryKey]='true'></e-column>
. . . . . . .
<e-column field='ShipCountry' headerText='ShipCountry' width='150'>
<ng-template #template let-data>
<div class="e-combo">
<input class='e-cmb'/>
</div>
</ng-template>
</e-column>
</e-columns>
</ejs-grid> |