The Essential JS 2 Angular 4 Data Grid supports the following edit modes to perform CRUD ( Create, Read, Update and Delete) actions through an interactive UI with simple configuration.
In this knowledge base, we are going to explain about, how to enable inline editing in Syncfusion Angular 4 Data Grid.
import { EditService,ToolbarService } from '@syncfusion/ej2-angular-grids'; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, GridModule ], providers: [EditService, ToolbarService], bootstrap: [AppComponent] }) export class AppModule { }
<ejs-grid [dataSource]='data' [editSettings]='editSettings' [toolbar]='toolbar' height='315px'> <e-columns> <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100></e-column> <e-column field='CustomerID' headerText='Customer ID' width=120></e-column> <e-column field='Freight' headerText='Freight' textAlign='Right' width=120 format='C2'></e-column> <e-column field='ShipCountry' headerText='Ship Country' width=150></e-column> </e-columns> </ejs-grid>
<ejs-grid [dataSource]='data' [editSettings]='editSettings' [toolbar]='toolbar' height='315px'> <e-columns> <e-column field='OrderID' headerText='Order ID' textAlign='Right' isPrimaryKey='true' width=100></e-column> <e-column field='CustomerID' headerText='Customer ID' width=120></e-column> <e-column field='Freight' headerText='Freight' textAlign='Right' width=120 format='C2'></e-column> <e-column field='ShipCountry' headerText='Ship Country' width=150></e-column> </e-columns> </ejs-grid> import { Component, OnInit } from '@angular/core'; import { EditSettingsModel, ToolbarItems } from '@syncfusion/ej2-angular-grids'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent implements OnInit { public data: Object[]; public editSettings: EditSettingsModel; public toolbar: ToolbarItems[]; ngOnInit() { this.editSettings = { allowEditing: true, allowAdding: true, allowDeleting: true, mode:"Normal" }; this.toolbar = ['Add', 'Edit', 'Delete', 'Update', 'Cancel']; } }
SummaryIn this GitHub repository, the application prepared from the above steps has been committed, and it is readily runnable. If you have any queries or require clarifications. Please let us know in comments below. You can also contact us through our Support forum or Direct-Trac. We are happy to assist you! |
This page will automatically be redirected to the sign-in page in 10 seconds.