user9923760
user9923760

Reputation: 656

Ag Grid -CellEditor FocusOut

I want to call this.params.api.stopEditing(); when the CellEditor lose the focus.

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()">

But focusOut is not triggered. Any idea why is not triggered?

Upvotes: 1

Views: 8234

Answers (2)

Marcos Laredo
Marcos Laredo

Reputation: 23

You can also add, at your gridOptions:

stopEditingWhenCellsLoseFocus: true

As you can see here: https://www.ag-grid.com/javascript-data-grid/cell-editing/#stop-editing-when-grid-loses-focus

Upvotes: 1

Paritosh
Paritosh

Reputation: 11598

It's not (focusOut), it's (focusout). Update your markup with that and verify.

For more references, check the answers for this post: HTML5 event handling(onfocus and onfocusout) using angular 2

Upvotes: 3

Related Questions