File tree Expand file tree Collapse file tree 3 files changed +24
-2
lines changed
projects/igniteui-angular/src/lib Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -3557,7 +3557,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
3557
3557
this . rendered$ . pipe ( takeUntil ( this . destroy$ ) ) . subscribe ( ( ) => {
3558
3558
if ( this . paginator ) {
3559
3559
this . paginator . perPage = this . _perPage !== DEFAULT_ITEMS_PER_PAGE ? this . _perPage : this . paginator . perPage ;
3560
- this . paginator . totalRecords = this . totalRecords ;
3560
+ this . paginator . totalRecords = this . totalRecords ? this . totalRecords : this . paginator . totalRecords ;
3561
3561
this . paginator . overlaySettings = { outlet : this . outlet } ;
3562
3562
}
3563
3563
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' ;
@@ -484,5 +484,14 @@ describe('IgxGrid - Grid Paging #grid', () => {
484
484
expect ( paginator ) . toBeDefined ( ) ;
485
485
expect ( grid . rowList . length ) . toBe ( 5 ) ;
486
486
} ) ) ;
487
+
488
+ fit ( 'paginator should show the exact number of pages when "totalRecords" is not set and "pagingMode" is remote' , fakeAsync ( ( ) => {
489
+ fix = TestBed . createComponent ( RemotePagingComponent ) ;
490
+ fix . detectChanges ( ) ;
491
+ tick ( ) ;
492
+
493
+ grid = fix . componentInstance . grid ;
494
+ expect ( grid . paginator . totalPages ) . toBe ( 4 ) ;
495
+ } ) ) ;
487
496
} ) ;
488
497
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