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
35713571 this . rendered$ . pipe ( takeUntil ( this . destroy$ ) ) . subscribe ( ( ) => {
35723572 if ( this . paginator ) {
35733573 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 ;
35753575 this . paginator . overlaySettings = { outlet : this . outlet } ;
35763576 }
35773577 this . _rendered = true ;
Original file line number Diff line number Diff line change 11import { TestBed , fakeAsync , tick } from '@angular/core/testing' ;
22import { IgxGridModule } from './public_api' ;
33import { 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' ;
55import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
66
77import { configureTestSuite } from '../../test-utils/configure-suite' ;
@@ -36,7 +36,8 @@ describe('IgxGrid - Grid Paging #grid', () => {
3636 TestBed . configureTestingModule ( {
3737 declarations : [
3838 PagingComponent ,
39- GridWithUndefinedDataComponent
39+ GridWithUndefinedDataComponent ,
40+ RemotePagingComponent
4041 ] ,
4142 imports : [ IgxGridModule , NoopAnimationsModule ]
4243 } ) ;
@@ -484,5 +485,14 @@ describe('IgxGrid - Grid Paging #grid', () => {
484485 expect ( paginator ) . toBeDefined ( ) ;
485486 expect ( grid . rowList . length ) . toBe ( 5 ) ;
486487 } ) ) ;
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+ } ) ) ;
487497} ) ;
488498
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { SampleTestData } from './sample-test-data.spec';
33import { ColumnDefinitions , GridTemplateStrings } from './template-strings.spec' ;
44import { IgxGridComponent } from '../grids/grid/grid.component' ;
55import { IgxColumnActionsComponent } from '../grids/column-actions/column-actions.component' ;
6+ import { GridPagingMode } from '../grids/common/enums' ;
67
78@Component ( {
89 template : `
@@ -95,6 +96,18 @@ export class PagingComponent extends GridWithSizeComponent {
9596 public data = SampleTestData . personJobDataFull ( ) ;
9697}
9798
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+
98111@Component ( {
99112 template : GridTemplateStrings . declareGrid ( ` rowSelection = "multiple"` ,
100113 '' , ColumnDefinitions . productBasicNumberID )
You can’t perform that action at this time.
0 commit comments