Skip to content

Commit bfc83ef

Browse files
authored
Merge branch 'master' into mdragnev/fix-4780-master
2 parents e3c2edb + aa19538 commit bfc83ef

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
@@ -30,9 +30,9 @@ All notable changes for each version of this project will be documented in this
3030
- 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.
3131

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

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

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

@@ -48,7 +48,7 @@ Currently the following components have only partial RTL support:
4848
- Circular Progress Indicator (igx-circular-bar)
4949

5050
We plan on adding support for the aforementioned components in the upcoming releases.
51-
51+
5252
### New Features
5353

5454
- 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.
@@ -70,6 +70,20 @@ The callback signature for both `cellStyles` and `cellClasses` is now changed to
7070

7171
- `IgxChip`
7272
- **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.
73+
- `IgxGrid` - Now you can access all grid data inside the custom column summary. Two additional optional parameters are introduced in the IgxSummaryOperand `operate` method.
74+
75+
```typescript
76+
class MySummary extends IgxNumberSummaryOperand {
77+
constructor() {
78+
super();
79+
}
80+
operate(columnData: any[], allGridData = [], fieldName?): IgxSummaryResult[] {
81+
const result = super.operate(allData.map(r => r[fieldName]));
82+
result.push({ key: 'test', label: 'Total Discounted', summaryResult: allData.filter((rec) => rec.Discontinued).length });
83+
return result;
84+
}
85+
}
86+
```
7387

7488
## 8.2.0
7589
### 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
@@ -198,9 +198,8 @@ export class GridBaseAPIService <T extends IgxGridBaseDirective & GridType> {
198198
row.data = { ...row.data, ...rowInEditMode.transactionState };
199199
// TODO: Workaround for updating a row in edit mode through the API
200200
} else if (this.grid.transactions.enabled) {
201-
const lastCommitedValue = grid.transactions.getState(row.id) ?
202-
grid.transactions.getState(row.id).value : null;
203-
row.data = lastCommitedValue ? Object.assign(row.data, lastCommitedValue) : row.data;
201+
const state = grid.transactions.getState(row.id);
202+
row.data = state ? Object.assign({}, row.data, state.value) : row.data;
204203
}
205204
}
206205

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3839,7 +3839,13 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
38393839
}
38403840
const row = new IgxRow(rowSelector, -1, this.gridAPI.getRowData(rowSelector));
38413841
this.gridAPI.update_row(row, value);
3842-
this.cdr.detectChanges();
3842+
3843+
// TODO: fix for #5934 and probably break for #5763
3844+
// consider adding of third optional boolean parameter in updateRow.
3845+
// If developer set this parameter to true we should call notifyChanges(true), and
3846+
// vise-versa if developer set it to false we should call notifyChanges(false).
3847+
// The parameter should default to false
3848+
this.notifyChanges();
38433849
}
38443850
}
38453851

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)