export class AppComponent {
public parentData: Object[];
public childGrid: any;
public editSettings: EditSettingsModel;
public toolbar: ToolbarItems[];
public selectionOptions: SelectionSettingsModel;
ngOnInit(): void {
this.childGrid = {
dataSource: orderDatas,
id: 'DestGrid',
queryString: 'EmployeeID',
allowPaging: true,
selectionSettings: { type: 'Multiple' },
toolbar: ['Add', 'Edit', 'Delete', 'Update', 'Cancel'],
actionBegin(args: any) {
if (args.requestType === "add") {
// `parentKeyFieldValue` refers to the queryString field value of the parent record.
const EmployeeID = "EmployeeID";
(args.data as object)[ EmployeeID] = this.parentDetails.parentKeyFieldValue;
}
},
editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal' },
pageSettings: {pageSize: 6, pageCount: 5},
columns: [
{ field: 'OrderID', headerText: 'Order ID', isPrimaryKey: true, textAlign: 'Right', width: 120 },
{ field: 'ShipCity', headerText: 'Ship City', width: 120 },
{ field: 'Freight', headerText: 'Freight', width: 120 },
{ field: 'ShipName', headerText: 'Ship Name', width: 150 }
]
};
}
} |