ag-grid angular - custom cell-editor tab not working after edit

Viewed 389

I have a simple cell editor. I noticed that when clicking on a cell and then trying to press tab, I am able to go to the next cell. But if I start editing the cell ( type "hello" ) and then press tab, then the next cell is not focused.

import { ICellEditorAngularComp } from '@ag-grid-community/angular';
import { AfterViewInit, Component, ViewChild, ViewContainerRef } from '@angular/core';

@Component({
  selector: 'cell-editor',
  template: `<input #input [(ngModel)]="value" />`,
})
export class AgTextCellEditorComponent implements ICellEditorAngularComp, AfterViewInit {
  value: string;

  @ViewChild('input', { read: ViewContainerRef }) input: ViewContainerRef;

  ngAfterViewInit() {
    setTimeout(() => this.input.element.nativeElement.focus());
  }

  agInit(params: any): void {
    this.value = params.value;
  }

  getValue(): any {
    return this.value;
  }

  isCancelBeforeStart(): boolean {
    return false;
  }

  isCancelAfterEnd(): boolean {
    return false;
  }
}

0 Answers
Related