Skip to content

Commit 9588cec

Browse files
authored
Merge pull request #9027 from IgniteUI/revert-paging-changes-m
Revert paging changes
2 parents 93bc728 + c2c641e commit 9588cec

16 files changed

+179
-554
lines changed

CHANGELOG.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ All notable changes for each version of this project will be documented in this
2020
- Support for `currency` type columns is added in the grid.
2121
- Support for `percent` type columns is added in the grid.
2222
- Added support for filtering based on the formatted cell values using the `FormattedValuesFilteringStrategy` for `IgxGrid`/`IgxHierarchicalGrid` and `TreeGridFormattedValuesFilteringStrategy` for `IgxTreeGrid`.
23-
- `IgxPaginator`
24-
- `paging` and `pagingDone` events are now emitted.
23+
- The following new events are introduced: `sorting`, `filtering`, `columnPinned`, `columnVisibilityChanging`.
24+
- **Behavioral Change** -
25+
- `onColumnPinning` to emit `IPinColumnCancellableEventArgs` instead of `IPinColumnEventArgs`.
26+
- `Column pinning`, `Column moving`, `paging` interactions now discard the editing value, instead of committing it.
27+
- `Column Resizing` now does not exit edit mode.
2528
- `IgxInput` now supports `type="file"` and its styling upon all themes.
2629
_Note: validation of file type input is not yet supported._
2730
- `igxSplitter` now has the following additional outputs:
@@ -105,12 +108,6 @@ All notable changes for each version of this project will be documented in this
105108
- `IgxGrid`, `IgxHierarchicalGrid`, `IgxTreeGrid`
106109
- Added new property `selectRowOnClick` that determines whether clicking over a row will change its selection state or not. Set to `true` by default.
107110
- `GridPagingMode` enum members rename - `local` to `Local` and `remote` to `Remote`. Example: `GridPagingMode.Local`.
108-
- The following new events are introduced: `sorting`, `filtering`, `columnPinned`, `columnVisibilityChanging`.
109-
- **Behavioral Change** -
110-
- `onColumnPinning` to emit `IPinColumnCancellableEventArgs` instead of `IPinColumnEventArgs`.
111-
- **Breaking Change**:
112-
- `onPagingDone` output is removed. Use the `paging` and `pagingDone` outputs exposed by the `IgxPaginator`.
113-
- `page`, `perPage`, `paginate`, `nextPage`, `previousPage` and `totalPages` in the grids are deprecated and will be removed. Use the corresponding `IgxPaginator` outputs/inputs. When using an external paginator, take care to provide the corresponding slice of data. See [`Paging with Custom Template`](https://www.infragistics.com/products/ignite-ui-angular/angular/components/grid/paging#remote-paging-with-custom-template)
114111
- IgxButton
115112
- IgxIcon(s) placed in a button now include margin if there are one or more sibling elements to give them some breathing room. The amount of margin applied depends on the display density of the button.
116113
- `IgxListComponent`

projects/igniteui-angular/src/lib/grids/common/events.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ export interface IPinColumnEventArgs extends IBaseEventArgs {
7070
export interface IPinColumnCancellableEventArgs extends IPinColumnEventArgs, CancelableEventArgs {
7171
}
7272

73+
/**
74+
* The event arguments after a page is changed.
75+
*/
76+
export interface IPageEventArgs extends IBaseEventArgs {
77+
previous: number;
78+
current: number;
79+
}
80+
7381
export interface IRowDataEventArgs extends IBaseEventArgs {
7482
data: any;
7583
}

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

Lines changed: 68 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ import {
117117
IRowSelectionEventArgs,
118118
IPinColumnEventArgs,
119119
IGridEditEventArgs,
120+
IPageEventArgs,
120121
IRowDataEventArgs,
121122
IColumnResizeEventArgs,
122123
IColumnMovingStartEventArgs,
@@ -139,7 +140,8 @@ import {
139140
IFilteringEventArgs,
140141
IColumnVisibilityChangedEventArgs,
141142
IColumnVisibilityChangingEventArgs,
142-
IPinColumnCancellableEventArgs
143+
IPinColumnCancellableEventArgs,
144+
IColumnResizingEventArgs
143145
} from './common/events';
144146
import { IgxAdvancedFilteringDialogComponent } from './filtering/advanced-filtering/advanced-filtering-dialog.component';
145147
import { GridType } from './common/grid.interface';
@@ -290,7 +292,6 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
290292
public onScroll = new EventEmitter<IGridScrollEventArgs>();
291293

292294
/**
293-
* @deprecated Use `IgxPaginator` corresponding output instead.
294295
* Emitted after the current page is changed.
295296
*
296297
* @example
@@ -303,12 +304,10 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
303304
* }
304305
* ```
305306
*/
306-
@DeprecateProperty('Use the corresponding output exposed by the `igx-paginator`.')
307307
@Output()
308308
public pageChange = new EventEmitter<number>();
309309

310310
/**
311-
* @deprecated Use `IgxPaginator` corresponding output instead.
312311
* Emitted when `perPage` property value of the grid is changed.
313312
*
314313
* @example
@@ -321,7 +320,6 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
321320
* }
322321
* ```
323322
*/
324-
@DeprecateProperty('Use the corresponding output exposed by the `igx-paginator`.')
325323
@Output()
326324
public perPageChange = new EventEmitter<number>();
327325

@@ -671,6 +669,19 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
671669
@Output()
672670
public onFilteringDone = new EventEmitter<IFilteringExpressionsTree>();
673671

672+
/**
673+
* Emitted after paging is performed.
674+
*
675+
* @remarks
676+
* Returns an object consisting of the previous and next pages.
677+
* @example
678+
* ```html
679+
* <igx-grid #grid [data]="localData" [height]="'305px'" [autoGenerate]="true" (onPagingDone)="pagingDone($event)"></igx-grid>
680+
* ```
681+
*/
682+
@Output()
683+
public onPagingDone = new EventEmitter<IPageEventArgs>();
684+
674685
/**
675686
* Emitted when a row added through the API.
676687
*
@@ -1422,7 +1433,6 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
14221433
}
14231434

14241435
/**
1425-
* @deprecated Use `IgxPaginator` corresponding method instead.
14261436
* Gets/Sets the current page index.
14271437
*
14281438
* @example
@@ -1432,7 +1442,6 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
14321442
* @remarks
14331443
* Supports two-way binding.
14341444
*/
1435-
@DeprecateProperty('Use the corresponding method exposed by the `igx-paginator`.')
14361445
@Input()
14371446
public get page(): number {
14381447
return this._page;
@@ -1443,14 +1452,14 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
14431452
return;
14441453
}
14451454
this.selectionService.clear(true);
1455+
this.onPagingDone.emit({ previous: this._page, current: val });
14461456
this._page = val;
14471457
this.pageChange.emit(this._page);
14481458
this.navigateTo(0);
14491459
this.notifyChanges();
14501460
}
14511461

14521462
/**
1453-
* @deprecated Use `IgxPaginator` corresponding method instead.
14541463
* Gets/Sets the number of visible items per page.
14551464
*
14561465
* @remarks
@@ -1460,7 +1469,6 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
14601469
* <igx-grid #grid [data]="Data" [paging]="true" [(perPage)]="model.perPage" [autoGenerate]="true"></igx-grid>
14611470
* ```
14621471
*/
1463-
@DeprecateProperty('Use the corresponding method exposed by the `igx-paginator`.')
14641472
@Input()
14651473
public get perPage(): number {
14661474
return this._perPage;
@@ -1473,9 +1481,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
14731481
this.selectionService.clear(true);
14741482
this._perPage = val;
14751483
this.perPageChange.emit(this._perPage);
1476-
if (this.totalPages !== 0 && this._page >= this.totalPages) {
1477-
this.page = this.totalPages - 1;
1478-
}
1484+
this.page = 0;
14791485
this.endEdit(false);
14801486
this.notifyChanges();
14811487
}
@@ -3086,57 +3092,6 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
30863092
this.cdr.detach();
30873093
}
30883094

3089-
/**
3090-
* @deprecated Use `IgxPaginator` corresponding method instead.
3091-
* Goes to the desired page index.
3092-
*
3093-
* @example
3094-
* ```typescript
3095-
* this.grid1.paginate(1);
3096-
* ```
3097-
* @param val
3098-
*/
3099-
@DeprecateProperty('Use the corresponding method exposed by the `igx-paginator`.')
3100-
public paginate(val: number): void {
3101-
if (val < 0 || val > this.totalPages - 1) {
3102-
return;
3103-
}
3104-
3105-
this.page = val;
3106-
}
3107-
3108-
/**
3109-
* @deprecated Use `IgxPaginator` corresponding method instead.
3110-
* Goes to the next page, if the grid is not already at the last page.
3111-
*
3112-
* @example
3113-
* ```typescript
3114-
* this.grid1.nextPage();
3115-
* ```
3116-
*/
3117-
@DeprecateProperty('Use the corresponding method exposed by the `igx-paginator`.')
3118-
public nextPage(): void {
3119-
if (!this.isLastPage) {
3120-
this.page += 1;
3121-
}
3122-
}
3123-
3124-
/**
3125-
* @deprecated Use `IgxPaginator` corresponding method instead.
3126-
* Goes to the previous page, if the grid is not already at the first page.
3127-
*
3128-
* @example
3129-
* ```typescript
3130-
* this.grid1.previousPage();
3131-
* ```
3132-
*/
3133-
@DeprecateProperty('Use the corresponding method exposed by the `igx-paginator`.')
3134-
public previousPage(): void {
3135-
if (!this.isFirstPage) {
3136-
this.page -= 1;
3137-
}
3138-
}
3139-
31403095
/**
31413096
* @hidden
31423097
* @internal
@@ -3355,6 +3310,11 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
33553310
this.zone.run(() => {
33563311
this.notifyChanges(true);
33573312
});
3313+
});
3314+
3315+
this.onPagingDone.pipe(destructor).subscribe(() => {
3316+
this.endEdit(false);
3317+
this.selectionService.clear(true);
33583318
});
33593319

33603320
this.onColumnMovingEnd.pipe(destructor).subscribe(() => this.endEdit(false));
@@ -3431,12 +3391,6 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
34313391
});
34323392
}
34333393

3434-
/** @hidden @internal */
3435-
public _pagingDone() {
3436-
this.endEdit(false);
3437-
this.selectionService.clear(true);
3438-
}
3439-
34403394
/**
34413395
* @hidden
34423396
*/
@@ -4168,15 +4122,13 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
41684122
}
41694123

41704124
/**
4171-
* @deprecated Use `IgxPaginator` corresponding method instead.
41724125
* Gets the total number of pages.
41734126
*
41744127
* @example
41754128
* ```typescript
41764129
* const totalPages = this.grid.totalPages;
41774130
* ```
41784131
*/
4179-
@DeprecateProperty('Use the corresponding method exposed by the `igx-paginator`.')
41804132
public get totalPages(): number {
41814133
if (this.pagingState) {
41824134
return this.pagingState.metadata.countPages;
@@ -4185,19 +4137,45 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
41854137
}
41864138

41874139
/**
4188-
* @deprecated Use `IgxPaginator` corresponding method instead.
41894140
* Gets if the current page is the first page.
41904141
*
41914142
* @example
41924143
* ```typescript
41934144
* const firstPage = this.grid.isFirstPage;
41944145
* ```
41954146
*/
4196-
@DeprecateProperty('Use the corresponding method exposed by the `igx-paginator`.')
41974147
public get isFirstPage(): boolean {
41984148
return this.page === 0;
41994149
}
42004150

4151+
/**
4152+
* Goes to the next page, if the grid is not already at the last page.
4153+
*
4154+
* @example
4155+
* ```typescript
4156+
* this.grid1.nextPage();
4157+
* ```
4158+
*/
4159+
public nextPage(): void {
4160+
if (!this.isLastPage) {
4161+
this.page += 1;
4162+
}
4163+
}
4164+
4165+
/**
4166+
* Goes to the previous page, if the grid is not already at the first page.
4167+
*
4168+
* @example
4169+
* ```typescript
4170+
* this.grid1.previousPage();
4171+
* ```
4172+
*/
4173+
public previousPage(): void {
4174+
if (!this.isFirstPage) {
4175+
this.page -= 1;
4176+
}
4177+
}
4178+
42014179
/**
42024180
* Returns the total number of records.
42034181
*
@@ -4222,15 +4200,13 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
42224200
}
42234201

42244202
/**
4225-
* @deprecated Use `IgxPaginator` corresponding method instead.
42264203
* Returns if the current page is the last page.
42274204
*
42284205
* @example
42294206
* ```typescript
42304207
* const lastPage = this.grid.isLastPage;
42314208
* ```
42324209
*/
4233-
@DeprecateProperty('Use the corresponding method exposed by the `igx-paginator`.')
42344210
public get isLastPage(): boolean {
42354211
return this.page + 1 >= this.totalPages;
42364212
}
@@ -4330,6 +4306,23 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
43304306
this.onColumnMovingEnd.emit({ source: column, target });
43314307
}
43324308

4309+
/**
4310+
* Goes to the desired page index.
4311+
*
4312+
* @example
4313+
* ```typescript
4314+
* this.grid1.paginate(1);
4315+
* ```
4316+
* @param val
4317+
*/
4318+
public paginate(val: number): void {
4319+
if (val < 0 || val > this.totalPages - 1) {
4320+
return;
4321+
}
4322+
4323+
this.page = val;
4324+
}
4325+
43334326
/**
43344327
* Manually marks the `IgxGridComponent` for change detection.
43354328
*

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,7 +1513,6 @@ describe('IgxGrid - Row Selection #grid', () => {
15131513

15141514
const secondRow = grid.getRowByIndex(1);
15151515
grid.onHeaderSelectorClick(UIInteractions.getMouseEvent('click'));
1516-
tick();
15171516
fix.detectChanges();
15181517

15191518
GridSelectionFunctions.verifyHeaderRowCheckboxState(fix, true);
@@ -1527,7 +1526,6 @@ describe('IgxGrid - Row Selection #grid', () => {
15271526

15281527
// Click on a single row
15291528
secondRow.onClick(UIInteractions.getMouseEvent('click'));
1530-
tick();
15311529
fix.detectChanges();
15321530

15331531
GridSelectionFunctions.verifyHeaderRowCheckboxState(fix, false, true);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@
243243
</div>
244244

245245
<ng-template #defaultPaginator>
246-
<igx-paginator [overlaySettings]="paginatorSettings" [displayDensity]="displayDensity" [(page)]="page" [totalRecords]="totalRecords" [(perPage)]="perPage" (pagingDone)="_pagingDone()">
246+
<igx-paginator [overlaySettings]="paginatorSettings" [displayDensity]="displayDensity" [(page)]="page" [totalRecords]="totalRecords" [(perPage)]="perPage">
247247
</igx-paginator>
248248
</ng-template>
249249

0 commit comments

Comments
 (0)