Skip to content

Commit 213ce13

Browse files
authored
Merge branch 'master' into fix-10328
2 parents ab95ebb + 1a5b043 commit 213ce13

File tree

6 files changed

+29
-17
lines changed

6 files changed

+29
-17
lines changed

projects/igniteui-angular/src/lib/grids/state.directive.spec.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,27 @@ describe('IgxGridState - input properties #grid', () => {
178178
expect(gridState).toBe(filteringState);
179179
});
180180

181+
it('setState should correctly restore grid filtering state from with null date values', () => {
182+
const fix = TestBed.createComponent(IgxGridStateComponent);
183+
fix.detectChanges();
184+
const grid = fix.componentInstance.grid;
185+
grid.getCellByColumn(0, 'OrderDate').value = null;
186+
fix.detectChanges();
187+
const state = fix.componentInstance.state;
188+
189+
const filteringState = '{"filtering":{"filteringOperands":[{"filteringOperands":[{"condition":{"name":"empty","isUnary":true,"iconName":"is-empty"},"fieldName":"OrderDate","ignoreCase":true,"searchVal":null}],"operator":1,"fieldName":"OrderDate"}],"operator":0,"type":0}}';
190+
const initialState = '{"filtering":{"filteringOperands":[],"operator":0}}';
191+
192+
let gridState = state.getState(true, 'filtering');
193+
expect(gridState).toBe(initialState);
194+
195+
state.setState(filteringState);
196+
gridState = state.getState(false, 'filtering') as IGridState;
197+
HelperFunctions.verifyFilteringExpressions(grid.filteringExpressionsTree, gridState);
198+
gridState = state.getState(true, 'filtering');
199+
expect(gridState).toBe(filteringState);
200+
});
201+
181202
it('setState should correctly restore grid filtering state from object', () => {
182203
const fix = TestBed.createComponent(IgxGridStateComponent);
183204
fix.detectChanges();

projects/igniteui-angular/src/lib/grids/state.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ export class IgxGridStateDirective {
549549
if (Array.isArray(expr.searchVal)) {
550550
expr.searchVal = new Set(expr.searchVal);
551551
} else {
552-
expr.searchVal = (dataType === 'date') ? new Date(Date.parse(expr.searchVal)) : expr.searchVal;
552+
expr.searchVal = expr.searchVal && (dataType === 'date') ? new Date(Date.parse(expr.searchVal)) : expr.searchVal;
553553
}
554554
expr.condition = this.generateFilteringCondition(dataType, expr.condition.name);
555555
expressionsTree.filteringOperands.push(expr);

src/app/grid-cell-api/grid-cell-api.sample.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import {
44
IgxTreeGridComponent,
55
IgxHierarchicalGridComponent,
66
CellType,
7-
IgxGridTransaction,
8-
IgxTransactionService
97
} from 'igniteui-angular';
108
import { HIERARCHICAL_SAMPLE_DATA } from '../shared/sample-data';
119

src/app/grid-row-api/grid-row-api.sample.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
IgxHierarchicalGridComponent,
77
IPinningConfig,
88
RowPinningPosition,
9-
IRowDragStartEventArgs,
109
GridSummaryCalculationMode,
1110
GridSummaryPosition
1211
} from 'igniteui-angular';
@@ -179,7 +178,6 @@ export class GridRowAPISampleComponent implements OnInit {
179178
public togglePinning(grid: IgxGridComponent | IgxTreeGridComponent | IgxHierarchicalGridComponent,
180179
byIndex: boolean, index: number, key: any) {
181180
const row: RowType = byIndex ? grid.getRowByIndex(index) : grid.getRowByKey(key);
182-
const index2: number = row.index;
183181
if (row.pinned) {
184182
row.unpin();
185183
} else {
@@ -308,16 +306,15 @@ export class GridRowAPISampleComponent implements OnInit {
308306
}
309307
}
310308

311-
public onEnter(args) {
309+
public onEnter() {
312310
this.dragIcon = 'add';
313311
}
314-
public onRowDragStart(args: IRowDragStartEventArgs) {
315-
const row = args.dragData;
312+
public onRowDragStart() {
316313
const count = this.grid.selectedRows.length || 1;
317314
this.countIcon = `filter_${count > 9 ? '9_plus' : `${count}`}`;
318315
}
319-
public onLeave(args) {
320-
this.onRowDragStart(args);
316+
public onLeave() {
317+
this.onRowDragStart();
321318
this.dragIcon = 'arrow_right_alt';
322319
}
323320
}

src/app/tree-grid-groupby/tree-grid-groupby.sample.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class TreeGridGroupBySampleComponent implements OnInit {
5959
this.density = this.displayDensities[event.index].label;
6060
}
6161

62-
public cellEditDone(event: any) {
62+
public cellEditDone() {
6363
this.groupingExpressions = [...this.groupingExpressions]; // will trigger grouping pipe
6464
}
6565
}

src/app/tree/tree.sample.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,18 +188,14 @@ export class TreeSampleComponent implements AfterViewInit, OnDestroy {
188188

189189
public ngAfterViewInit() {
190190
this.tree.nodes.toArray().forEach(node => {
191-
node.selectedChange.subscribe((ev) => {
192-
// console.log(ev);
193-
});
191+
node.selectedChange.subscribe(() => {});
194192
});
195193
}
196194

197195
public ngOnDestroy() {
198196
}
199197

200-
public toggleSelectionMode(args) {
201-
// this.tree.selection = this.selectionModes[args.index].selectMode;
202-
}
198+
public toggleSelectionMode() { }
203199

204200
public changeDensity(args) {
205201
this.density = this.displayDensities[args.index].selectMode;

0 commit comments

Comments
 (0)