|
[index.js]
export class NormalEdit extends SampleBase {
comboboxObj;
shipCountryEditTemplate = {
create: () => {
var elem = document.createElement('input');
return elem;
},
destroy: () => {
this.comboboxObj.destroy();
},
read: () => {
return this.comboboxObj.value;
// return the value which will be saved to the
Grid
},
write: (args) => {
this.comboboxObj = new ComboBox({
// bind the
Data to datasource property
dataSource: hierarchyOrderdata,
floatLabelType: 'Always',
// bind the cell value
value: args.rowData[args.column.field],
// maps the appropriate column to fields property
fields: { text: 'ShipCountry', value: 'ShipCountry' },
});
this.comboboxObj.appendTo(args.element);
},
};
render() {
return (
<GridComponent
dataSource={hierarchyOrderdata}
ref={(grid) => (this.gridInstance = grid)}
toolbar={this.toolbarOptions}
allowPaging={true}
editSettings={this.editSettings}
>
<ColumnsDirective>
<ColumnDirective
field="ShipCountry"
headerText="Ship Country"
width="150"
edit={this.shipCountryEditTemplate}
></ColumnDirective>
</ColumnsDirective>
<Inject services={[Page, Toolbar, Edit]} />
</GridComponent>
);
}
}
|