Skip to content

Commit 3fba870

Browse files
committed
refactor(grid): rename rowSelected to rowSelectionChanging
1 parent 2e83004 commit 3fba870

20 files changed

+186
-138
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ All notable changes for each version of this project will be documented in this
7373
- Inputs `showToolbar`, `toolbarTitle`, `columnHiding`, `columnHidingTitle`, `hiddenColumnsText`,
7474
`columnPinning`, `columnPinningTitle`, `pinnedColumnsText`.
7575
Use `IgxGridToolbarComponent`, `IgxGridToolbarHidingComponent`, `IgxGridToolbarPinningComponent` instead.
76+
- **Breaking Change** - The `rowSelected` event is renamed to `rowSelectionChanging` to better reflect its function
7677
- `igxGrid`
7778
- Exposed a `groupStrategy` input that functions similarly to `sortStrategy`, allowing customization of the grouping behavior of the grid. Please, refer to the [Group By ](https://www.infragistics.com/products/ignite-ui-angular/angular/components/grid/groupby) topic for more information.
7879
- `IgxColumnActionsComponent`

projects/igniteui-angular/migrations/update-13_0_0/changes/members.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@
2121
"definedIn": [
2222
"IgxComboBaseDirective"
2323
]
24+
},
25+
{
26+
"member": "rowSelected",
27+
"replaceWith": "rowSelectionChanging",
28+
"definedIn": [
29+
"IgxGridComponent",
30+
"IgxTreeGridComponent",
31+
"IgxHierarchicalGridComponent",
32+
"IgxRowIslandComponent"
33+
]
2434
}
2535
]
2636
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"$schema": "../../common/schema/binding.schema.json",
3+
"changes": [
4+
{
5+
"name": "rowSelected",
6+
"replaceWith": "rowSelectionChanging",
7+
"owner": {
8+
"selector": "igx-grid",
9+
"type": "component"
10+
}
11+
},
12+
{
13+
"name": "rowSelected",
14+
"replaceWith": "rowSelectionChanging",
15+
"owner": {
16+
"selector": "igx-tree-grid",
17+
"type": "component"
18+
}
19+
},
20+
{
21+
"name": "rowSelected",
22+
"replaceWith": "rowSelectionChanging",
23+
"owner": {
24+
"selector": "igx-hierarchical-grid",
25+
"type": "component"
26+
}
27+
},
28+
{
29+
"name": "rowSelected",
30+
"replaceWith": "rowSelectionChanging",
31+
"owner": {
32+
"selector": "igx-row-island",
33+
"type": "component"
34+
}
35+
}
36+
]
37+
}

projects/igniteui-angular/src/lib/grids/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ A list of the events emitted by the **igx-grid**:
228228
|`columnMovingEnd`|Emitted when a column moving ends. Returns the source and target columns objects. This event is cancelable.|
229229
|`columnMovingStart`|Emitted when a column moving starts. Returns the moved column object.|
230230
|`selected`|Emitted when a cell is selected. Returns the cell object.|
231-
|`rowSelected`|Emitted when a row selection has changed. Returns array with old and new selected rows' IDs and the target row, if available.|
231+
|`rowSelectionChanging`|Emitted when row selection is changing. Returns array with old and new selected rows' IDs and the target row, if available.|
232232
|`columnSelected`|Emitted when a column selection has changed. Returns array with old and new selected column' fields|
233233
|`columnInit`|Emitted when the grid columns are initialized. Returns the column object.|
234234
|`sortingDone`|Emitted when sorting is performed through the UI. Returns the sorting expression.|

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,11 +465,11 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
465465
*
466466
* @example
467467
* ```html
468-
* <igx-grid #grid (rowSelected)="onCellClickChange($event)" [data]="localData" [autoGenerate]="true"></igx-grid>
468+
* <igx-grid #grid (rowSelectionChanging)="rowSelectionChanging($event)" [data]="localData" [autoGenerate]="true"></igx-grid>
469469
* ```
470470
*/
471471
@Output()
472-
public rowSelected = new EventEmitter<IRowSelectionEventArgs>();
472+
public rowSelectionChanging = new EventEmitter<IRowSelectionEventArgs>();
473473

474474
/**
475475
* Emitted when `IgxColumnComponent` is selected.

projects/igniteui-angular/src/lib/grids/grid/grid-row-selection.spec.ts

Lines changed: 99 additions & 99 deletions
Large diffs are not rendered by default.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ describe('IgxGrid - GroupBy #grid', () => {
11731173
tick();
11741174
fix.detectChanges();
11751175

1176-
const selectionSpy = spyOn(grid.rowSelected, 'emit');
1176+
const selectionSpy = spyOn(grid.rowSelectionChanging, 'emit');
11771177
GridFunctions.simulateGridContentKeydown(fix, 'Space');
11781178
fix.detectChanges();
11791179

@@ -1263,7 +1263,7 @@ describe('IgxGrid - GroupBy #grid', () => {
12631263
tick();
12641264
fix.detectChanges();
12651265

1266-
const selectionSpy = spyOn(grid.rowSelected, 'emit');
1266+
const selectionSpy = spyOn(grid.rowSelectionChanging, 'emit');
12671267
GridFunctions.simulateGridContentKeydown(fix, 'Space');
12681268
fix.detectChanges();
12691269

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ export class IgxChildGridRowComponent implements AfterViewInit, OnInit {
7070
*
7171
* ```typescript
7272
* handleRowSelection(event) {
73-
* // the grid on which the rowSelected event was triggered
73+
* // the grid on which the rowSelectionChanging event was triggered
7474
* const grid = event.row.grid;
7575
* }
7676
* ```
7777
*
7878
* ```html
7979
* <igx-grid
8080
* [data]="data"
81-
* (rowSelected)="handleRowSelection($event)">
81+
* (rowSelectionChanging)="handleRowSelection($event)">
8282
* </igx-grid>
8383
* ```
8484
*/

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -627,14 +627,14 @@ describe('IgxHierarchicalGrid selection #hGrid', () => {
627627
}
628628
});
629629

630-
it('should have fire event rowSelected', () => {
630+
it('should have fire event rowSelectionChanging', () => {
631631
hierarchicalGrid.expandChildren = true;
632632
fix.detectChanges();
633633
const childGrid = hierarchicalGrid.hgridAPI.getChildGrids(false)[0];
634634
const secondChildGrid = hierarchicalGrid.hgridAPI.getChildGrids(false)[1];
635-
const parentSpy = spyOn<any>(hierarchicalGrid.rowSelected, 'emit').and.callThrough();
636-
const childSpy = spyOn<any>(childGrid.rowSelected, 'emit').and.callThrough();
637-
const secondChildSpy = spyOn<any>(secondChildGrid.rowSelected, 'emit').and.callThrough();
635+
const parentSpy = spyOn<any>(hierarchicalGrid.rowSelectionChanging, 'emit').and.callThrough();
636+
const childSpy = spyOn<any>(childGrid.rowSelectionChanging, 'emit').and.callThrough();
637+
const secondChildSpy = spyOn<any>(secondChildGrid.rowSelectionChanging, 'emit').and.callThrough();
638638
const mockEvent = new MouseEvent('click');
639639

640640
// Click on a row in child grid

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,15 +336,15 @@ export class IgxRowDirective<T extends IgxGridBaseDirective & GridType> implemen
336336
*
337337
* ```typescript
338338
* handleRowSelection(event) {
339-
* // the grid on which the rowSelected event was triggered
339+
* // the grid on which the rowSelectionChanging event was triggered
340340
* const grid = event.row.grid;
341341
* }
342342
* ```
343343
*
344344
* ```html
345345
* <igx-grid
346346
* [data]="data"
347-
* (rowSelected)="handleRowSelection($event)">
347+
* (rowSelectionChanging)="handleRowSelection($event)">
348348
* </igx-grid>
349349
* ```
350350
*/

0 commit comments

Comments
 (0)