Ag Grid -CellEditor FocusOut

Ag Grid -CellEditor FocusOut

我想在 CellEditor 失去焦点时调用 this.params.api.stopEditing();

app.component.ts

onFocusOut(): void {
   this.params.api.stopEditing();
}

app.component.html

<input #container triggers="" type="text" #dp="bsDatepicker" class="form-control" (bsValueChange)="onValueChange($event)" bsDatepicker 
[bsConfig]="{ dateInputFormat: 'DD.MM.YYYY', containerClass: 'theme-dark-blue' }"
[(ngModel)]="dateValue"
[minDate]="minDate"
[maxDate]="maxDate"
(focusOut)="onFocusOut()">

但是没有触发focusOut。知道为什么没有触发吗?

不是 (focusOut),是 (focusout)。用它更新您的标记并验证。

如需更多参考,请查看此 post 的答案:

您还可以在您的网格选项中添加:

stopEditingWhenCellsLoseFocus: true

如您所见:https://www.ag-grid.com/javascript-data-grid/cell-editing/#stop-editing-when-grid-loses-focus