|
export class NormalEdit extends SampleBase {
constructor() {
this.editOptions = {
allowEditing: true,
allowAdding: true,
allowDeleting: true,
mode: "Batch"
};
}
ddlData = DataUtil.distinct(cascadeData, "ShipState", true);
dpParams = {
create: () => {
this.elem = document.createElement("input");
return this.elem;
},
read: () => {
return this.dropDownListObj.value;
},
destroy: () => {
this.dropDownListObj.destroy();
},
write: args => {
this.dropDownListObj = new DropDownList({
dataSource: this.ddlData,
fields: { value: "ShipState", text: "ShipState" },
value: args.rowData[args.column.field]
});
this.dropDownListObj.appendTo(this.elem);
}
};
render() {
return (
<div>
<GridComponent
dataSource={orderDataSource.slice(0, 5)}
>
<ColumnsDirective>
<ColumnDirective
field="ShipCountry"
headerText="Ship Country"
width="150"
editType="dropdownedit"
edit={this.dpParams}
textAlign="Right"
/>
</ColumnsDirective>
<Inject services={[Edit, Toolbar]} />
</GridComponent>
</div>
);
}
}
render(<NormalEdit />, document.getElementById("sample")); |