Skip to content

Commit 7530579

Browse files
committed
fix(hgird): Fix resources not applying to child grids and islands.
1 parent 4f0f3f2 commit 7530579

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3245,6 +3245,7 @@ export abstract class IgxGridBaseDirective implements GridType,
32453245
};
32463246
protected _hGridSchema: EntityType[];
32473247
protected gridComputedStyles;
3248+
protected _resourceStrings = null;
32483249

32493250
/** @hidden @internal */
32503251
public get paginator() {
@@ -3282,7 +3283,6 @@ export abstract class IgxGridBaseDirective implements GridType,
32823283
private _loadingGridTemplate: TemplateRef<IgxGridTemplateContext>;
32833284

32843285
private _cdrRequests = false;
3285-
private _resourceStrings = null;
32863286
private _defaultResourceStrings = getCurrentResourceStrings(GridResourceStringsEN);
32873287
private _emptyGridMessage = null;
32883288
private _emptyFilteredGridMessage = null;

projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid.component.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ import { IgxActionStripToken } from '../../action-strip/token';
6969
import { flatten } from '../../core/utils';
7070
import { IFilteringExpressionsTree } from '../../data-operations/filtering-expressions-tree';
7171
import { IgxScrollInertiaDirective } from '../../directives/scroll-inertia/scroll_inertia.directive';
72+
import { IGridResourceStrings } from 'igniteui-angular';
7273

7374
let NEXT_ID = 0;
7475

@@ -606,6 +607,26 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirecti
606607
return this._hGridSchema;
607608
}
608609

610+
/**
611+
* Gets/Sets the resource strings.
612+
*
613+
* @remarks
614+
* By default it uses EN resources.
615+
*/
616+
@Input()
617+
public override set resourceStrings(value: IGridResourceStrings) {
618+
super.resourceStrings = value;
619+
if (!this.parent) {
620+
this.gridAPI.getChildGrids(true).forEach((grid) => {
621+
grid.resourceStrings = value;
622+
});
623+
}
624+
}
625+
626+
public override get resourceStrings() {
627+
return super.resourceStrings;
628+
}
629+
609630
/**
610631
* Gets the unique identifier of the parent row. It may be a `string` or `number` if `primaryKey` of the
611632
* parent grid is set or an object reference of the parent record otherwise.
@@ -733,6 +754,7 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirecti
733754
this.rootGrid.hasChildrenKey;
734755
this.showExpandAll = this.parentIsland ?
735756
this.parentIsland.showExpandAll : this.rootGrid.showExpandAll;
757+
this.resourceStrings = this.parentIsland?.resourceStrings ?? this.rootGrid.resourceStrings;
736758
}
737759

738760
/**

projects/igniteui-angular/src/lib/grids/hierarchical-grid/row-island.component.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import { IgxGridValidationService } from '../grid/grid-validation.service';
5151
import { IgxTextHighlightService } from '../../directives/text-highlight/text-highlight.service';
5252
import { IgxPaginatorComponent } from '../../paginator/paginator.component';
5353
import { BaseFormatter, I18N_FORMATTER } from '../../core/i18n/formatters/formatter-base';
54+
import { IGridResourceStrings } from '../../core/i18n/grid-resources';
5455

5556
/* blazorCopyInheritedMembers */
5657
/* blazorElement */
@@ -116,6 +117,24 @@ export class IgxRowIslandComponent extends IgxHierarchicalGridBaseDirective
116117
this.key = value;
117118
}
118119

120+
/**
121+
* Gets/Sets the resource strings.
122+
*
123+
* @remarks
124+
* By default it uses the root grid resources.
125+
*/
126+
@Input()
127+
public override set resourceStrings(value: IGridResourceStrings) {
128+
this._resourceStrings = value;
129+
this.rowIslandAPI.getChildGrids().forEach((grid) => {
130+
grid.resourceStrings = value;
131+
});
132+
}
133+
134+
public override get resourceStrings() {
135+
return this._resourceStrings ?? this.rootGrid.resourceStrings;
136+
}
137+
119138
/**
120139
* @hidden
121140
*/

0 commit comments

Comments
 (0)