[app.component.html]
<ejs-grid #normalgrid id='Normalgrid' [dataSource]='data' allowPaging='true' [pageSettings]='pageSettings' [editSettings]='editSettings' [toolbar]='toolbar' (actionBegin)='actionBegin($event)'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' width='140' textAlign='Right' isPrimaryKey='true' [validationRules]='orderidrules'></e-column>
---------------
</e-columns>
</ejs-grid>
---------------------------------------------------------------------------------------------------------------------
[app.component.ts]
export class AppComponent {
@ViewChild('ddsample')
public dropDown: DropDownListComponent;
public data: Object[];
public editSettings: Object;
public toolbar: string[];
public orderidrules: Object;
----
public ngOnInit(): void {
this.data = orderDataSource;
this.editSettings = { allowEditing: true, allowAdding: true, allowDeleting: true , newRowPosition: 'Top' };
this.toolbar = ['Add', 'Edit', 'Delete', 'Update', 'Cancel'];
this.orderidrules = { required: [true,'OrderID is required'], number: true };
-----
}
|