import { enableRipple } from '@syncfusion/ej2-base';
enableRipple(true);
import { Grid, Toolbar, Edit, Page } from '@syncfusion/ej2-grids';
import { orderData } from './data-source';
/**
* Batch Editing sample
*/
Grid.Inject(Edit, Toolbar, Page);
let grid: Grid = new Grid(
{
dataSource: orderData,
editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Batch' },
toolbarClick: (args) => {
if (args.item.text === 'Update') {
(grid.editModule as any).dialogObj.beforeOpen = dlgOPen
}
},
pageSettings: { pageCount: 5 },
toolbar: ['Add', 'Delete', 'Update', 'Cancel'],
. . .
function dlgOPen(args) {
let div = document.createElement('div');
this.contentEle.append(div);
if ((grid.editModule.getBatchChanges() as any).addedRecords.length) {
let span = document.createElement('span');
span.innerHTML = 'added : ' + JSON.stringify((grid.editModule.getBatchChanges() as any).addedRecords);
div.appendChild(span);
}
.. .
}
this.width = 'auto'
}
|