|
[app.component.html]
<ejs-grid
#grid
[dataSource]="data"
[editSettings]="editSettings"
[toolbar]="toolbar"
height="350"
>
<e-columns>
<e-column
field="OrderID"
headerText="Order ID"
width="120"
isPrimaryKey="true"
textAlign="Right"
></e-column>
<e-column field="ShipCountry" width="200">
<ng-template #headerTemplate let-data
>Customer ID
<ejs-dropdownlist
id="ddlelement"
#samples
[dataSource]="dddata"
[fields]="fields"
[placeholder]="text"
(change)="dropdownchange($event)"
></ejs-dropdownlist>
</ng-template>
</e-column>
-----
</e-columns>
</ejs-grid>
[app.component.ts]
dropdownchange(args) {
var rows = this.grid.getRows();
var currentViewData = this.grid.getCurrentViewRecords();
for (var i = 0; i < rows.length; i++) {
currentViewData[i]["ShipCountry"] = args.value;
// update the selected value in the current page
this.grid.updateRow(parseInt(rows[0].getAttribute("aria-rowindex")), currentViewData[i]);
}
}
|