ngAfterViewInit(args: any): void {
document.getElementById('grid').addEventListener('keydown', () => {
this.grid.editModule.saveCell();
var index = this.grid.selectedRowIndex;
var field;
if ((window as any).field === 'EmployeeID') { // 6th column
field = 'ShipName';
}
if ((window as any).field === 'ShipName') { // 8th column
field = 'CustomerID';
}
if ((window as any).field === 'CustomerID') { // 9th column
index++;
field = 'EmployeeID';
}
if((window as any).field ==='EmployeeID' || (window as any).field ==='ShipName' || (window as any).field ==='CustomerID') {
this.grid.editModule.editCell(index, field);
}
})
} |
cellSave(args): void {
if (args.columnName === 'ShipCountry' && args.value ==='Austria') {
this.grid.setCellValue(args.rowData.OrderID,"CustomerID",'Modified Value');
}
(window as any).field = args.columnName;
} |
Hi Sahal,We are happy that the problem has been solved.Please get back to us if you need any further assistance.Regards,Thavasianand S.
document.getElementById('grid').addEventListener('keydown', () => {
this.grid.editModule.saveCell();
var index = this.grid.selectedRowIndex;
var field;
if ((window as any).field === 'EmployeeID') {
field = 'ShipName';
}
if ((window as any).field === 'ShipName') {
field = 'CustomerID';
}
if ((window as any).field === 'CustomerID') {
if (index == this.grid.getRows().length - 1) { //check if its last row
this.grid.editModule.addRecord();
}
// because the newly added row at the top of the position
index = 0;
field = 'EmployeeID';
}
if ((window as any).field === 'EmployeeID' || (window as any).field === 'ShipName' || (window as any).field === 'CustomerID') {
this.grid.editModule.editCell(index, field);
}
})
}
|
ngAfterViewInit(args: any): void {
document.getElementById('grid').addEventListener('keydown', () => {
this.grid.editModule.saveCell();
var index = this.grid.selectedRowIndex;
var field;
if ((window as any).field === 'EmployeeID') {
field = 'ShipName';
}
if ((window as any).field === 'ShipName') {
field = 'CustomerID';
}
if ((window as any).field === 'CustomerID') {
if (index >= this.grid.getRows().length - 1) { //check if its last row or newly added row
this.grid.editModule.addRecord();
}
index++;
field = 'EmployeeID';
}
if ((window as any).field === 'EmployeeID' || (window as any).field === 'ShipName' || (window as any).field === 'CustomerID') {
this.grid.editModule.editCell(index, field);
}
})
}
|
if ((window as any).field === 'CustomerID') {
if (index >= this.grid.contentModule.getRows().length - 1) { //check if its last row
this.grid.editModule.addRecord();
}
index++;
field = 'EmployeeID';
}
|
...
@Component({
...
})
export class BatchEditComponent implements OnInit {
...
}
ngAfterViewInit(args: any): void {
document.getElementById('grid').addEventListener('keydown', function (e) {
if (e.keyCode == 13) {
(this.grid as any).keyConfigs.enter = "";
(e.target as any).parentElement.classList.remove('e-input-focus');
let currentEle: any = parentsUntil(e.target as any, 'e-rowcell');
let currentIdx: any = (currentEle as any).cellIndex;
if (currentIdx == 4) {
this.grid.editModule.endEdit();
}
else {
let gForm: any = parentsUntil(currentEle as any, 'e-gridform');
let nextInput: any = gForm.querySelectorAll('input')[currentIdx + 1];
nextInput.focus();
nextInput.parentElement.classList.add('e-input-focus');
}
}
}.bind(this))
}
}
|
...
else {
let gForm: any = parentsUntil(currentEle as any, 'e-gridform');
let nextInput: any;
if(gForm.querySelectorAll('td')[currentIdx + 1].classList.contains('e-hide')){
nextInput = gForm.querySelectorAll('td')[currentIdx + 2].querySelector('input');
}
else{
nextInput = gForm.querySelectorAll('td')[currentIdx + 1].querySelector('input');
}
nextInput.focus();
nextInput.parentElement.classList.add('e-input-focus');
}... |