Skip to content

Commit 28f8a35

Browse files
committed
fix(adv-filtering): improve child entities fields population on row expand
1 parent 3cc7307 commit 28f8a35

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

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

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirecti
12371237
}
12381238

12391239
private generateSchema() {
1240-
const filterableFields = this.columns.filter((column) => !column.columnGroup && column.filterable);
1240+
const filterableFields: FieldType[] = this.columns.filter((column) => !column.columnGroup && column.filterable);
12411241
let entities: EntityType[];
12421242

12431243
if(filterableFields.length !== 0) {
@@ -1247,8 +1247,8 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirecti
12471247
fields: filterableFields.map(f => ({
12481248
field: f.field,
12491249
dataType: f.dataType,
1250-
// label: f.label,
1251-
// header: f.header,
1250+
label: f.label,
1251+
header: f.header,
12521252
editorOptions: f.editorOptions,
12531253
filters: f.filters,
12541254
pipeArgs: f.pipeArgs,
@@ -1282,25 +1282,25 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirecti
12821282

12831283
path.reverse();
12841284
if (path.length > 0) {
1285-
let childLevel = path[0];
1286-
let childEntity;
1287-
while (childLevel) {
1288-
childEntity = schema[0].childEntities.find(e => e.name === childLevel);
1289-
childLevel = path.shift();
1285+
let childEntity = schema[0];
1286+
for (let i = 0; i < path.length; i++) {
1287+
childEntity = childEntity.childEntities.find(e => e.name === path[i]);
12901288
}
12911289

1292-
childEntity.fields = event.columns.filter((column) => !column.columnGroup && column.filterable)
1293-
.map(f => ({
1294-
field: f.field,
1295-
dataType: f.dataType,
1296-
label: f.label,
1297-
header: f.header,
1298-
editorOptions: f.editorOptions,
1299-
filters: f.filters,
1300-
pipeArgs: f.pipeArgs,
1301-
defaultTimeFormat: f.defaultTimeFormat,
1302-
defaultDateTimeFormat: f.defaultDateTimeFormat
1303-
})) as FieldType[];
1290+
if (childEntity) {
1291+
childEntity.fields = event.columns.filter((column) => !column.columnGroup && column.filterable)
1292+
.map(f => ({
1293+
field: f.field,
1294+
dataType: f.dataType,
1295+
label: f.label,
1296+
header: f.header,
1297+
editorOptions: f.editorOptions,
1298+
filters: f.filters,
1299+
pipeArgs: f.pipeArgs,
1300+
defaultTimeFormat: f.defaultTimeFormat,
1301+
defaultDateTimeFormat: f.defaultDateTimeFormat
1302+
})) as FieldType[];
1303+
}
13041304
}
13051305
}
13061306

projects/igniteui-angular/src/lib/query-builder/query-builder-tree.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,7 @@ export class IgxQueryBuilderTreeComponent implements AfterViewInit, OnDestroy {
14101410
* @hidden @internal
14111411
*/
14121412
public getFormat(field: string) {
1413-
return this.fields?.find(el => el.field === field).pipeArgs.format;
1413+
return this.fields?.find(el => el.field === field)?.pipeArgs.format;
14141414
}
14151415

14161416
/**

0 commit comments

Comments
 (0)