Skip to content

Commit a15ba77

Browse files
author
pipeline
committed
feature(EJ2-3757): Batch editing sample added.
1 parent 51eab1b commit a15ba77

36 files changed

+110
-41
lines changed

src/grid/aggregatedefault-plnkr.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/grid/aggregategroup-plnkr.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/grid/batch-editing-plnkr.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

src/grid/batch-editing.component.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { Component, OnInit } from '@angular/core';
2+
import { orderDatas } from './data';
3+
import { EditService, ToolbarService, PageService } from '@syncfusion/ej2-ng-grids';
4+
5+
@Component({
6+
selector: 'ej-gridbatchedit',
7+
templateUrl: 'batch-editing.html',
8+
providers: [ToolbarService, EditService, PageService]
9+
})
10+
export class BatchEditComponent implements OnInit {
11+
public data: Object[];
12+
public editSettings: Object;
13+
public toolbar: string[];
14+
public orderidrules: Object;
15+
public customeridrules: Object;
16+
public freightrules: Object;
17+
public editparams: Object;
18+
public pageSettings: Object;
19+
20+
public ngOnInit(): void {
21+
this.data = orderDatas;
22+
this.editSettings = { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'batch' };
23+
this.toolbar = ['add', 'edit', 'delete', 'update', 'cancel'];
24+
this.orderidrules = { required: true };
25+
this.customeridrules = { required: true };
26+
this.freightrules = { required: true };
27+
this.editparams = { params: { popupHeight: '300px' }};
28+
this.pageSettings = {pageCount: 5};
29+
}
30+
}

src/grid/batch-editing.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<div class="control-section">
2+
<ej-grid [dataSource]='data' allowPaging='true' [pageSettings]='pageSettings' [editSettings]='editSettings' [toolbar]='toolbar'>
3+
<e-columns>
4+
<e-column field='OrderID' headerText='Order ID' width='120' textAlign="right" isPrimaryKey='true' [validationRules]='orderidrules'></e-column>
5+
<e-column field='CustomerID' headerText='Customer ID' width='120' textAlign="right" [validationRules]='customeridrules'></e-column>
6+
<e-column field='Freight' headerText='Freight' width='120' format='C2' textAlign="right" editType='numericedit' [validationRules]='freightrules'></e-column>
7+
<e-column field='ShipName' headerText='Ship Name' width='170'></e-column>
8+
<e-column field='ShipCountry' headerText='Ship Country' width='150' editType='dropdownedit' [edit]='editparams' ></e-column>
9+
</e-columns>
10+
</ej-grid>
11+
<div id="description">
12+
<p>
13+
Batch editing mode is used to send bulk request (add, update and delete) to Grid. You can start editing by double clicking
14+
a cell and can change cell value. Edited cell will be highlighted while navigating to next cell or any other
15+
row, so that you know which fields or cells has been edited.
16+
</p>
17+
<p>In this demo, batch editing is enabled by defining mode as `batch`.</p>
18+
<br>
19+
<p style="font-weight: 500">Injecting Module</p>
20+
<p>
21+
Grid component features are segregated into individual feature-wise modules. To use editing feature, we need to inject
22+
<code><a target="_blank" class="code"
23+
href="http://ej2.syncfusion.com/angular/documentation/grid/api-edit.html">
24+
EditService
25+
</a></code> into the <code>@NgModule.providers</code> section.
26+
</p>
27+
</div>
28+
</div>

src/grid/column/autowrap-plnkr.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/grid/column/columnchooser-plnkr.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/grid/column/columnchooser.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ export class ColumnChooserComponent implements OnInit {
1212
public toolbar: string[];
1313
ngOnInit(): void {
1414
this.data = data;
15-
this.toolbar = ['columnchooser'];
15+
this.toolbar = ['columnchooser'];
1616
}
1717
}

src/grid/column/reorder-plnkr.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/grid/column/showhide-plnkr.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)