File tree Expand file tree Collapse file tree 3 files changed +26
-3
lines changed
projects/igniteui-angular/src/lib Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -3571,7 +3571,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
3571
3571
this . rendered$ . pipe ( takeUntil ( this . destroy$ ) ) . subscribe ( ( ) => {
3572
3572
if ( this . paginator ) {
3573
3573
this . paginator . perPage = this . _perPage !== DEFAULT_ITEMS_PER_PAGE ? this . _perPage : this . paginator . perPage ;
3574
- this . paginator . totalRecords = this . totalRecords ;
3574
+ this . paginator . totalRecords = this . totalRecords ? this . totalRecords : this . paginator . totalRecords ;
3575
3575
this . paginator . overlaySettings = { outlet : this . outlet } ;
3576
3576
}
3577
3577
this . _rendered = true ;
Original file line number Diff line number Diff line change 1
1
import { TestBed , fakeAsync , tick } from '@angular/core/testing' ;
2
2
import { IgxGridModule } from './public_api' ;
3
3
import { GridWithUndefinedDataComponent } from '../../test-utils/grid-samples.spec' ;
4
- import { PagingComponent } from '../../test-utils/grid-base-components.spec' ;
4
+ import { PagingComponent , RemotePagingComponent } from '../../test-utils/grid-base-components.spec' ;
5
5
import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
6
6
7
7
import { configureTestSuite } from '../../test-utils/configure-suite' ;
@@ -36,7 +36,8 @@ describe('IgxGrid - Grid Paging #grid', () => {
36
36
TestBed . configureTestingModule ( {
37
37
declarations : [
38
38
PagingComponent ,
39
- GridWithUndefinedDataComponent
39
+ GridWithUndefinedDataComponent ,
40
+ RemotePagingComponent
40
41
] ,
41
42
imports : [ IgxGridModule , NoopAnimationsModule ]
42
43
} ) ;
@@ -484,5 +485,14 @@ describe('IgxGrid - Grid Paging #grid', () => {
484
485
expect ( paginator ) . toBeDefined ( ) ;
485
486
expect ( grid . rowList . length ) . toBe ( 5 ) ;
486
487
} ) ) ;
488
+
489
+ it ( 'paginator should show the exact number of pages when "totalRecords" is not set and "pagingMode" is remote' , fakeAsync ( ( ) => {
490
+ fix = TestBed . createComponent ( RemotePagingComponent ) ;
491
+ fix . detectChanges ( ) ;
492
+ tick ( ) ;
493
+
494
+ grid = fix . componentInstance . grid ;
495
+ expect ( grid . paginator . totalPages ) . toBe ( 4 ) ;
496
+ } ) ) ;
487
497
} ) ;
488
498
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { SampleTestData } from './sample-test-data.spec';
3
3
import { ColumnDefinitions , GridTemplateStrings } from './template-strings.spec' ;
4
4
import { IgxGridComponent } from '../grids/grid/grid.component' ;
5
5
import { IgxColumnActionsComponent } from '../grids/column-actions/column-actions.component' ;
6
+ import { GridPagingMode } from '../grids/common/enums' ;
6
7
7
8
@Component ( {
8
9
template : `
@@ -95,6 +96,18 @@ export class PagingComponent extends GridWithSizeComponent {
95
96
public data = SampleTestData . personJobDataFull ( ) ;
96
97
}
97
98
99
+ @Component ( {
100
+ template : GridTemplateStrings . declareGrid ( '[pagingMode]="pagingMode"' ,
101
+ '' , ColumnDefinitions . idNameJobTitle , '' ,
102
+ '<igx-paginator [perPage]="perPage" [totalRecords]="totalRecords"></igx-paginator>' )
103
+ } )
104
+ export class RemotePagingComponent extends GridWithSizeComponent {
105
+ public pagingMode = GridPagingMode . Remote ;
106
+ public perPage = 3 ;
107
+ public totalRecords = 10 ;
108
+ public data = SampleTestData . personJobDataFull ( ) ;
109
+ }
110
+
98
111
@Component ( {
99
112
template : GridTemplateStrings . declareGrid ( ` rowSelection = "multiple"` ,
100
113
'' , ColumnDefinitions . productBasicNumberID )
You can’t perform that action at this time.
0 commit comments