Skip to content

Commit 11d7bba

Browse files
mddragnevdkamburov
andauthored
Remove some code from the old API. Fix tree grid cross-field cells wi… (#3091)
* Remove some code from the old API. Fix tree grid cross-field cells with select component. Some more issues * Add missing import in hgrid configuration for live editing * Add ReactiveFormsModule to ngImports too * Move the new import to the right sample Co-authored-by: Deyan Kamburov <dkamburov@users.noreply.github.com>
1 parent 061e783 commit 11d7bba

6 files changed

Lines changed: 15 additions & 13 deletions

File tree

live-editing/configs/TreeGridConfigGenerator.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
IgxSparklineModule
3434
} from 'igniteui-angular-charts';
3535
import { Router, RouterModule } from '@angular/router';
36+
import { ReactiveFormsModule } from '@angular/forms';
3637
import { AppModuleConfig, Config, IConfigGenerator } from 'igniteui-live-editing';
3738
export class TreeGridConfigGenerator implements IConfigGenerator {
3839
public additionalImports = {
@@ -1168,9 +1169,9 @@ export class TreeGridConfigGenerator implements IConfigGenerator {
11681169
],
11691170
appModuleConfig: new AppModuleConfig({
11701171
imports: ['IgxPreventDocumentScrollModule', 'IgxTreeGridModule', 'TreeGridValidatorServiceCrossFieldComponent',
1171-
'IgxButtonModule', 'IgxTooltipModule'],
1172+
'IgxButtonModule', 'IgxTooltipModule', 'ReactiveFormsModule'],
11721173
ngDeclarations: ['TreeGridValidatorServiceCrossFieldComponent'],
1173-
ngImports: ['IgxPreventDocumentScrollModule', 'IgxTreeGridModule', 'IgxButtonModule', 'IgxTooltipModule']
1174+
ngImports: ['IgxPreventDocumentScrollModule', 'IgxTreeGridModule', 'IgxButtonModule', 'IgxTooltipModule', 'ReactiveFormsModule']
11741175
})
11751176
}));
11761177

src/app/grid/grid-validator-service-cross-field/grid-validator-service-cross-field.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<ng-template igxCellValidationError let-cell='cell' let-defaultErr='defaultErrorTemplate'>
1818
<ng-container *ngTemplateOutlet="defaultErr" >
1919
</ng-container>
20-
<div *ngIf="cell.errors?.['beyondThreshold']">
20+
<div *ngIf="cell.validation.errors?.['beyondThreshold']">
2121
The date cannot be in the future.
2222
</div>
2323
</ng-template>
@@ -32,7 +32,7 @@
3232
<ng-template igxCellValidationError let-cell='cell' let-defaultErr='defaultErrorTemplate'>
3333
<ng-container *ngTemplateOutlet="defaultErr">
3434
</ng-container>
35-
<div *ngIf="cell.errors?.['beyondThreshold']">
35+
<div *ngIf="cell.validation.errors?.['beyondThreshold']">
3636
The date cannot be in the future.
3737
</div>
3838
</ng-template>

src/app/hierarchical-grid/hierarchical-grid-validator-service-extended/hierarchical-grid-validator-service-extended.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<ng-template igxCellValidationError let-cell='cell' let-defaultErr="defaultErrorTemplate">
1111
<ng-container *ngTemplateOutlet="defaultErr">
1212
</ng-container>
13-
<div *ngIf="cell.validations.errors?.['phoneFormat']">
13+
<div *ngIf="cell.validation.errors?.['phoneFormat']">
1414
Please enter correct phone format
1515
</div>
1616
</ng-template>

src/app/hierarchical-grid/hierarchical-grid-validator-service-extended/hierarchical-grid-validator-service-extended.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ export class HierarchicalGridValidatorServiceExtendedComponent {
4848
const requiredDateRecord = formGroupArgs.formGroup.get('RequiredDate');
4949
const shippedDateRecord = formGroupArgs.formGroup.get('ShippedDate');
5050

51-
orderDateRecord.addValidators(this.futureDateValidator());
52-
requiredDateRecord.addValidators([this.futureDateValidator(), this.pastDateValidator()]);
53-
shippedDateRecord.addValidators([this.futureDateValidator(), this.pastDateValidator()]);
51+
orderDateRecord?.addValidators(this.futureDateValidator());
52+
requiredDateRecord?.addValidators([this.futureDateValidator(), this.pastDateValidator()]);
53+
shippedDateRecord?.addValidators([this.futureDateValidator(), this.pastDateValidator()]);
5454
}
5555

5656
public get hasTransactions(): boolean {

src/app/tree-grid/tree-grid-validator-service-cross-field/tree-grid-validator-service-cross-field.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
<igx-column field="Age" header="Age" dataType="number" [editable]="true" required min="18" max="99"></igx-column>
77
<igx-column field="Name" header="Full Name" dataType="string" [editable]="true" required></igx-column>
88
<igx-column field="City" header="City" dataType="string" [editable]="true" required>
9-
<ng-template igxCellEditor let-cell="cell" >
10-
<igx-select [(ngModel)]="cell.editValue" [igxFocus]="true">
9+
<ng-template igxCellEditor let-cell="cell" let-fc='formControl'>
10+
<igx-select [formControl]="fc" [igxFocus]="true" >
1111
<igx-select-item *ngFor="let city of cities" [value]="city">
1212
{{ city }}
1313
</igx-select-item>
1414
</igx-select>
1515
</ng-template>
1616
</igx-column>
1717
<igx-column field="Country" header="Country" dataType="string" [editable]="true" required>
18-
<ng-template igxCellEditor let-cell="cell">
19-
<igx-select [(ngModel)]="cell.editValue" [igxFocus]="true">
18+
<ng-template igxCellEditor let-cell="cell" let-fc='formControl'>
19+
<igx-select [formControl]="fc" [igxFocus]="true">
2020
<igx-select-item *ngFor="let country of countries" [value]="country">
2121
{{ country }}
2222
</igx-select-item>

src/app/tree-grid/tree-grid.module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// tslint:disable:max-line-length
33
import { CommonModule } from '@angular/common';
44
import { NgModule } from '@angular/core';
5-
import { FormsModule } from '@angular/forms';
5+
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
66
import {
77
IgxActionStripModule,
88
IgxAvatarModule,
@@ -233,6 +233,7 @@ import { TreeGridValidationStyleComponent } from './tree-grid-validation-style/t
233233
imports: [
234234
CommonModule,
235235
FormsModule,
236+
ReactiveFormsModule,
236237
IgxPreventDocumentScrollModule,
237238
TreeGridRoutingModule,
238239
IgxTreeGridModule,

0 commit comments

Comments
 (0)