Skip to content

Commit c713b37

Browse files
authored
Merge branch '8.2.x' into mdragnev/fix-4780-8.2.x
2 parents d932dbd + e3a5e62 commit c713b37

File tree

4 files changed

+64
-7
lines changed

4 files changed

+64
-7
lines changed

CHANGELOG.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ All notable changes for each version of this project will be documented in this
1111
- The header text of the columns and the column groups now has the `title` attribute set to it in order to expose a native browser tooltip.
1212

1313
### RTL Support
14-
Most of the components in the framework now have full right-to-left (RTL) support via the newly included RTL themes.
14+
Most of the components in the framework now have full right-to-left (RTL) support via the newly included RTL themes.
1515

16-
For CSS-based projects add `node_modules/igniteui-angular/styles/igniteui-angular-rtl.css` to your angular.json styles collection.
16+
For CSS-based projects add `node_modules/igniteui-angular/styles/igniteui-angular-rtl.css` to your angular.json styles collection.
1717

1818
For Sass-based projects pass `$direction` to the `igx-core` mixin in your root stylesheet.
1919

@@ -29,7 +29,7 @@ Currently the following components have only partial RTL support:
2929
- Circular Progress Indicator (igx-circular-bar)
3030

3131
We plan on adding support for the aforementioned components in the upcoming releases.
32-
32+
3333
### New Features
3434

3535
- Columns now expose the `cellStyles` property which allows conditional styling of the column cells. Similar to `cellClasses` it accepts an object literal where the keys are style properties and the values are expressions for evaluation.
@@ -51,6 +51,20 @@ The callback signature for both `cellStyles` and `cellClasses` is now changed to
5151

5252
- `IgxChip`
5353
- **Breaking Change** The `originalEvent` property for the events `onMoveStart`, `onMoveEnd`, `onClick` and `onSelection` now provides the events, passed from the `igxDrag` directive. The passed original events are in other words the previous events that triggered the `igxChip` ones. They also have original events until a browser event is reached.
54+
- `IgxGrid` - Now you can access all grid data inside the custom column summary. Two additional optional parameters are introduced in the IgxSummaryOperand `operate` method.
55+
56+
```typescript
57+
class MySummary extends IgxNumberSummaryOperand {
58+
constructor() {
59+
super();
60+
}
61+
operate(columnData: any[], allGridData = [], fieldName?): IgxSummaryResult[] {
62+
const result = super.operate(allData.map(r => r[fieldName]));
63+
result.push({ key: 'test', label: 'Total Discounted', summaryResult: allData.filter((rec) => rec.Discontinued).length });
64+
return result;
65+
}
66+
}
67+
```
5468

5569
## 8.2.0
5670
### New theme

projects/igniteui-angular/src/lib/grids/api.service.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,8 @@ export class GridBaseAPIService <T extends IgxGridBaseComponent & IGridDataBinda
199199
row.data = { ...row.data, ...rowInEditMode.transactionState };
200200
// TODO: Workaround for updating a row in edit mode through the API
201201
} else if (this.grid.transactions.enabled) {
202-
const lastCommitedValue = grid.transactions.getState(row.id) ?
203-
grid.transactions.getState(row.id).value : null;
204-
row.data = lastCommitedValue ? Object.assign(row.data, lastCommitedValue) : row.data;
202+
const state = grid.transactions.getState(row.id);
203+
row.data = state ? Object.assign({}, row.data, state.value) : row.data;
205204
}
206205
}
207206

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3940,7 +3940,13 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
39403940
}
39413941
const row = new IgxRow(rowSelector, -1, this.gridAPI.getRowData(rowSelector));
39423942
this.gridAPI.update_row(row, value);
3943-
this.cdr.detectChanges();
3943+
3944+
// TODO: fix for #5934 and probably break for #5763
3945+
// consider adding of third optional boolean parameter in updateRow.
3946+
// If developer set this parameter to true we should call notifyChanges(true), and
3947+
// vise-versa if developer set it to false we should call notifyChanges(false).
3948+
// The parameter should default to false
3949+
this.notifyChanges();
39443950
}
39453951
}
39463952

projects/igniteui-angular/src/lib/grids/grid/grid-cell-editing.spec.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,44 @@ describe('IgxGrid - Cell Editing #grid', () => {
694694
expect(cell.value).toEqual('New Name');
695695
});
696696

697+
it(`Should not update data in grid with transactions, when row is updated in onCellEdit and onCellEdit is canceled`, () => {
698+
fixture = TestBed.createComponent(SelectionWithTransactionsComponent);
699+
fixture.detectChanges();
700+
grid = fixture.componentInstance.grid;
701+
702+
grid.primaryKey = 'ID';
703+
fixture.detectChanges();
704+
705+
// update the cell value via updateRow and cancel the event
706+
grid.onCellEdit.subscribe((e: IGridEditEventArgs) => {
707+
const rowIndex: number = e.cellID.rowIndex;
708+
const row = grid.getRowByIndex(rowIndex);
709+
grid.updateRow({[row.columns[e.cellID.columnID].field]: e.newValue}, row.rowID);
710+
e.cancel = true;
711+
});
712+
713+
const cell = grid.getCellByColumn(0, 'Name');
714+
const initialValue = cell.value;
715+
const firstNewValue = 'New Value';
716+
const secondNewValue = 'Very New Value';
717+
718+
cell.update(firstNewValue);
719+
fixture.detectChanges();
720+
expect(cell.value).toBe(firstNewValue);
721+
722+
cell.update(secondNewValue);
723+
fixture.detectChanges();
724+
expect(cell.value).toBe(secondNewValue);
725+
726+
grid.transactions.undo();
727+
fixture.detectChanges();
728+
expect(cell.value).toBe(firstNewValue);
729+
730+
grid.transactions.undo();
731+
fixture.detectChanges();
732+
expect(cell.value).toBe(initialValue);
733+
});
734+
697735
it(`Should properly emit 'onCellEditCancel' event`, () => {
698736
spyOn(grid.onCellEditCancel, 'emit').and.callThrough();
699737
const cell = grid.getCellByColumn(0, 'fullName');

0 commit comments

Comments
 (0)