diff --git a/src/app/components/pab-table/pab-table.component.html b/src/app/components/pab-table/pab-table.component.html index 063a7339aabc51054b508fbcb74405df7138c569..e27aeda84881ea837e26d9a8c3b200945208a1f3 100644 --- a/src/app/components/pab-table/pab-table.component.html +++ b/src/app/components/pab-table/pab-table.component.html @@ -86,7 +86,8 @@ [title]="cellTitle(cell)"> <input matInput *ngIf="isNumberInput(cell)" step="0.00000000000001" type="number" required - [(ngModel)]="cell.model.singleValue" (input)="inputValueChanged($event, cell)"> + [ngModel]="getCellValue(cell)" (ngModelChange)="setCellValue(cell,$event)" + (input)="inputValueChanged($event, cell)"> <mat-select #selectWidget *ngIf="isSelect(cell)" [value]="cell.modelValue" (selectionChange)="loiDebitSelected($event, cell)"> diff --git a/src/app/components/pab-table/pab-table.component.ts b/src/app/components/pab-table/pab-table.component.ts index 7d95042fbe040b74b0ce78be4079036ccdc2478e..f22816c7dfc97d65842dede42319def5acb459a2 100644 --- a/src/app/components/pab-table/pab-table.component.ts +++ b/src/app/components/pab-table/pab-table.component.ts @@ -190,6 +190,9 @@ export class PabTableComponent implements AfterViewInit, AfterViewChecked, OnIni if (cell.uiValidity !== undefined) { valid = valid && cell.uiValidity; } + if (cell.modelValidity !== undefined) { + valid = valid && cell.modelValidity; + } return ! valid; } @@ -1439,6 +1442,19 @@ export class PabTableComponent implements AfterViewInit, AfterViewChecked, OnIni this.updateValidity(); } + public getCellValue(cell) { + return cell.model.singleValue; + } + + public setCellValue(cell, event) { + try { + cell.model.singleValue = event + cell.modelValidity = undefined; + } catch (error) { + cell.modelValidity = false; + } + } + /** * Computes the global Pab validity : validity of every cell of every row */