Skip to content

Commit c203e6c

Browse files
committed
refactor(grids): move filteredData getter to base
1 parent 2045f9d commit c203e6c

File tree

6 files changed

+18
-74
lines changed

6 files changed

+18
-74
lines changed

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

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,7 +1766,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
17661766

17671767
if (this.filteringService.isFilteringExpressionsTreeEmpty(this._filteringExpressionsTree) &&
17681768
this.filteringService.isFilteringExpressionsTreeEmpty(this._advancedFilteringExpressionsTree)) {
1769-
this.filteredData = null;
1769+
this._filteredData = null;
17701770
}
17711771

17721772
this.filteringService.refreshExpressions();
@@ -1803,7 +1803,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
18031803

18041804
if (this.filteringService.isFilteringExpressionsTreeEmpty(this._filteringExpressionsTree) &&
18051805
this.filteringService.isFilteringExpressionsTreeEmpty(this._advancedFilteringExpressionsTree)) {
1806-
this.filteredData = null;
1806+
this._filteredData = null;
18071807
}
18081808

18091809
this.selectionService.clearHeaderCBState();
@@ -3114,6 +3114,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
31143114
private _rowEditable = false;
31153115
private _currentRowState: any;
31163116
private _filteredSortedData = null;
3117+
private _filteredData = null;
31173118

31183119
private _customDragIndicatorIconTemplate: TemplateRef<IgxGridEmptyTemplateContext>;
31193120
private _excelStyleHeaderIconTemplate: TemplateRef<IgxGridHeaderTemplateContext>;
@@ -3216,7 +3217,19 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
32163217
*/
32173218
public abstract id: string;
32183219
public abstract data: any[] | null;
3219-
public abstract filteredData: any[];
3220+
3221+
/**
3222+
* Returns an array of objects containing the filtered data.
3223+
*
3224+
* @example
3225+
* ```typescript
3226+
* let filteredData = this.grid.filteredData;
3227+
* ```
3228+
*/
3229+
public get filteredData() {
3230+
return this._filteredData;
3231+
}
3232+
32203233
/**
32213234
* Returns an array containing the filtered sorted data.
32223235
*
@@ -3730,11 +3743,11 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
37303743
this._filteredPinnedData = data || [];
37313744
const filteredUnpinned = this._filteredUnpinnedData || [];
37323745
const filteredData = [... this._filteredPinnedData, ...filteredUnpinned];
3733-
this.filteredData = filteredData.length > 0 ? filteredData : this._filteredUnpinnedData;
3746+
this._filteredData = filteredData.length > 0 ? filteredData : this._filteredUnpinnedData;
37343747
} else if (this.hasPinnedRecords && !pinned) {
37353748
this._filteredUnpinnedData = data;
37363749
} else {
3737-
this.filteredData = data;
3750+
this._filteredData = data;
37383751
}
37393752
}
37403753

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -334,18 +334,6 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
334334
}
335335
}
336336

337-
/**
338-
* Gets an array of objects containing the filtered data.
339-
*
340-
* @example
341-
* ```typescript
342-
* let filteredData = this.grid.filteredData;
343-
* ```
344-
*/
345-
public get filteredData() {
346-
return this._filteredData;
347-
}
348-
349337
/**
350338
* Gets/Sets the total number of records in the data source.
351339
*
@@ -369,7 +357,6 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
369357
private get _gridAPI(): IgxGridAPIService {
370358
return this.gridAPI as IgxGridAPIService;
371359
}
372-
private _filteredData = null;
373360

374361
private childDetailTemplates: Map<any, any> = new Map();
375362

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,6 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirecti
337337
public childRow: IgxChildGridRowComponent;
338338

339339
private _data;
340-
private _filteredData = null;
341340
private h_id = `igx-hierarchical-grid-${NEXT_ID++}`;
342341
private childGridTemplates: Map<any, any> = new Map();
343342
private scrollTop = 0;
@@ -411,18 +410,6 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirecti
411410
super.excelStyleFilteringComponent;
412411
}
413412

414-
/**
415-
* Returns an array of objects containing the filtered data in the `IgxHierarchicalGridComponent`.
416-
* ```typescript
417-
* let filteredData = this.grid.filteredData;
418-
* ```
419-
*
420-
* @memberof IgxHierarchicalGridComponent
421-
*/
422-
public get filteredData() {
423-
return this._filteredData;
424-
}
425-
426413
/**
427414
* Gets/Sets the total number of records in the data source.
428415
*

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ export class IgxRowIslandComponent extends IgxHierarchicalGridBaseDirective
144144
*/
145145
public rootGrid: GridType = null;
146146
public readonly data: any[] | null;
147-
public readonly filteredData: any[];
148147

149148
private ri_columnListDiffer;
150149
private layout_id = `igx-row-island-`;

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,6 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
547547
protected override _defaultExpandState = false;
548548
protected override _filterStrategy: IFilteringStrategy = new DimensionValuesFilteringStrategy();
549549
private _data;
550-
private _filteredData;
551550
private _pivotConfiguration: IPivotConfiguration = { rows: null, columns: null, values: null, filters: null };
552551
private p_id = `igx-pivot-grid-${NEXT_ID++}`;
553552
private _superCompactMode = false;
@@ -1090,19 +1089,6 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
10901089
return this._data;
10911090
}
10921091

1093-
/**
1094-
* Returns an array of objects containing the filtered data.
1095-
* ```typescript
1096-
* let filteredData = this.grid.filteredData;
1097-
* ```
1098-
*
1099-
* @memberof IgxHierarchicalGridComponent
1100-
*/
1101-
public get filteredData() {
1102-
return this._filteredData;
1103-
}
1104-
1105-
11061092
/**
11071093
* @hidden
11081094
*/

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

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,6 @@ export class IgxTreeGridComponent extends IgxGridBaseDirective implements GridTy
271271
private _data;
272272
private _rowLoadingIndicatorTemplate: TemplateRef<void>;
273273
private _expansionDepth = Infinity;
274-
private _filteredData = null;
275274

276275
/**
277276
* An @Input property that lets you fill the `IgxTreeGridComponent` with an array of data.
@@ -295,33 +294,6 @@ export class IgxTreeGridComponent extends IgxGridBaseDirective implements GridTy
295294
this.cdr.markForCheck();
296295
}
297296

298-
/**
299-
* Returns an array of objects containing the filtered data in the `IgxGridComponent`.
300-
* ```typescript
301-
* let filteredData = this.grid.filteredData;
302-
* ```
303-
*
304-
* @memberof IgxTreeGridComponent
305-
*/
306-
public get filteredData() {
307-
return this._filteredData;
308-
}
309-
310-
/**
311-
* Sets an array of objects containing the filtered data in the `IgxGridComponent`.
312-
* ```typescript
313-
* this.grid.filteredData = [{
314-
* ID: 1,
315-
* Name: "A"
316-
* }];
317-
* ```
318-
*
319-
* @memberof IgxTreeGridComponent
320-
*/
321-
public set filteredData(value) {
322-
this._filteredData = value;
323-
}
324-
325297
/**
326298
* Get transactions service for the grid.
327299
*

0 commit comments

Comments
 (0)