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
35573557 this . rendered$ . pipe ( takeUntil ( this . destroy$ ) ) . subscribe ( ( ) => {
35583558 if ( this . paginator ) {
35593559 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 ;
35613561 this . paginator . overlaySettings = { outlet : this . outlet } ;
35623562 }
35633563 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' ;
@@ -484,5 +484,14 @@ describe('IgxGrid - Grid Paging #grid', () => {
484484 expect ( paginator ) . toBeDefined ( ) ;
485485 expect ( grid . rowList . length ) . toBe ( 5 ) ;
486486 } ) ) ;
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+ } ) ) ;
487496} ) ;
488497
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